Forum Discussion
Connect to a Web Service sending parameters
- Anonymous9 years ago
got my query working.
Thanks everyone.
thanks a lot for your reply!
I manage to make it work in my API using a little bit different code. POST Rest API.
My API needs full URL, and I needed to add timeout parameter. For default, Power BI has a 5 minute timout limit.
The way the timeout duration works is (day,hour,minute,second). So my code below has a 2 hours timeout limit.
for authentication, my API uses login password encoded on base 64.
The command #"Authorization" = "base64-encoded user: password" did not work, so I changed to #"Authorization" = "basic dXNlcjpwYXNzd29yZA==". (there is no space after "user:", but ":" and "p" makes a useless emoji... user:password)
Where "user: password" equals to "dXNlcjpwYXNzd29yZA==", using https://www.base64encode.org/ to encode/decode.
let
url = "http://full.api/url/here/including/all/subfolders",
body = "{""parameter as date"":""2017-10-31"",
""parameter as boolean"":true,
""parameter as number"":3
}",
Source = Json.Document(Web.Contents(url,[
Headers =[#"Content-Type"="application/json", #"Authorization" = "basic "],
Content = Text.ToBinary(body) , Timeout=#duration(0,2,0,0)
]
)),
in
#"Source"
Anonymous Great if you managed to make it work.
yes, I also changed my user:pass in to 64encode externally and then entered in M.
My API only returns a limited data, so now I am working to paginate it, recursively.
- Anonymous8 years agoNot applicable
nice! once you get it paginated correctly, please share the pagination code here.
thanks!