Forum Discussion
How to add body into Web.Contents()?
- 9 years ago
Done!
Solution from here: https://eriksvensen.wordpress.com/2014/09/15/specifying-json-query-in-power-query-example-statistics-sweden/
let content = "{ ""method"": ""get"", ""params"": { ""SelectionCriteria"": {}, ""FieldNames"": [""Id"", ""Name""] } }", Source = Json.Document(Web.Contents("https://api-sandbox.direct.yandex.com/json/v5/campaigns", [Headers=[Authorization="Bearer AQAAAAANlKwBAAQQn4Wfgbxxxxxxxxxx"], Content=Text.ToBinary(content)])) in Source
Thanks for your post .
I am trying to do a similar connection to an url, however I don’t see the table with the information that I need.
This is the code I am using:
let
url = “https://urladdress”,
body = “{ “”statisticType””: “”[“”CMD_Stock””]””, “”startDate””: “”2020-04-07″” , “”endDate””: “”2020-04-07″” }”,
Source = Json.Document(Web.Contents(url,[Headers = [#”Content-Type”=”application/json”], Content = Text.ToBinary(body) ] ))
in
Source
I need to obtain the following structure in Power BI (a table with three columns):
statisticType startDate endDate
CMD_Stock 07/04/2020 07/04/2020
CMD_Stock 07/04/2020 07/04/2020
CMD_Stock 07/04/2020 07/04/2020
Can you help me? Thanks mdsr.