Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I'm having following issue:
I need to get the data (json file) through the power query (using token).
My query:
= Web.Contents("https://api.direct.yandex.ru/v4/json/", [Query=[method="GetSummaryStat", StartDate="2017-01-01", EndDate="2017-02-28", oauth_token="mytoken"]], [Content=[???????]])
Question is:
What should I write in "Contents" to set the method to POST as the data source requires POST method only.
Thank you!
Tnaks for the article!
I read the documentation, and the sample of json query for my source is like that:
{ "method": "GetSummaryStat", "param": { /* GetSummaryStatRequest */ "CampaignIDS": [ (int) ... ], "StartDate": (date), "EndDate": (date) } }
According to it my query looks like that:
let url = "https://api.direct.yandex.ru/v4/json/", content="{""method"": ""GetSummaryStat"",
""param"": {""CampaignIDS"": [[14835862]],
""StartDate"": ""2017-01-01"",
""EndDate"": ""2017-02-01""#(lf)
}}", source = Json.Document(Web.Contents(url, [Content=Text.ToBinary(content)], [Query=[oauth_token="token"]])) in source
And still I got mistake.
Best wishes,
Alena
Hi @Alena. Did you make it work?
Could you please share your code here?
how could I use POST method using username and password? (my API does not accept tokens)
I am getting error 405 METHOD NOT ALLOWED on my code below. It seems username and password are not pushed inside API.
I am new to M language and not used to the correct syntax I think...
let
apiUrl = "http://xxxxx",
options = [Headers =[#"Content-Type"="application/json",
#"Authorization" = "(base64-encoded username : password)"]],
Value = Web.Contents(apiUrl,options)
in
Value
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |