Forum Discussion
gilbertendaya
6 years agoHelper IV
Error in getting POST request in an API
Hi, Need your help with my issue in Power BI. Here is the M-Script let url = URL, body = "{""limit"": -1,""sort"": {""option"": ""ASC"",""field"": [""FlightDate""},""parameters"": [{}],""r...
- 6 years ago
You could simply using different code.
This first example you've posted contained wrong brackets.
Why is that?
Could it be that JSON you've been using in Postman has different nesting structure?
Must your -1 be a text instead of a number?
Honestly, I've been there a couple of times to recognize that a simple typo is throwing things off.
Very had to believe that Power Query is the issue here.
gilbertendaya
6 years agoHelper IV
Thanks ImkeF
I tried the one that you suggested, but below error occurred.
Expression.Error: We cannot convert a value of type Record to type Binary.
Details:
Value=[Record]
Type=[Type]
ImkeF
6 years agoCommunity Champion
Oh sorry, I missed the magic function Json.FromValue: https://www.thebiccountant.com/2018/06/05/easy-post-requests-with-power-bi-and-power-query-using-json-fromvalue/
Source =
Json.Document( Web.Contents(url, Headers=[#"Content-Type"="application/json"],Content = Json.FromValue(Parsed_JSON)]))