Forum Discussion

dpombal's avatar
dpombal
Post Partisan
6 years ago
Solved

HTTP POST request with form urlencoded data

Hi all,   I am trying to reproduce below API HTTP Post call , successful in Postman: Postman configuration Authorization key with a tokensequence Body with 3 parameters and important select opt...
  • dpombal's avatar
    dpombal
    6 years ago

    This option worked finally for me, will try to make code better using parameters, but is is a good start.

     

    CODE OK

    let
    auth_key ="XXXXXXXXXXXXXXXXXXX",
    base_url = "www.hostname.com",
    extension = "/api/datos_de_recarga/chargedata.php",
    url = base_url &extension,
    header= [#"Authorization" = auth_key,
    #"Content-Type" = "application/x-www-form-urlencoded"],
    content1= "[email protected]&PASSWORD=XXXXXX&INICIO=2019-11-01T00:00:00Z",
    webdata1 = Web.Contents(url, [Headers=[#"Authorization" = auth_key,
    #"Content-Type" = "application/x-www-form-urlencoded"],Content = Text.ToBinary(content1)]),
    response1 = Json.Document(webdata1)
    in
    response1