Forum Discussion
Error in getting POST request in an API
- 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.
When I tried to get the data after this line:
let
url = URL,
//body = "{""limit"": -1,""sort"": {""option"": ""ASC"",""field"": [""FlightDate""},""parameters"": [{}],""range"": [{""FlightDate"": {""from"": ""02/14/2020 14:02"",""to"": ""02/18/2020 00:02""}}]}",
body = "{""limit"": ""-1"",""sort"": {""option"": ""ASC"",""field"": [""FlightDate""]},""parameters"": [{}],""range"": [{""FlightDate"": {""from"": ""02/14/2020 14:02"",""to"": ""02/18/2020 00:02""}}]}",
Parsed_JSON = Json.Document(body),
BuildQueryString = Uri.BuildQueryString(Parsed_JSON)
//Source = Json.Document(Web.Contents(url, [Headers=[#"Content-Type"="application/x-www-form-urlencoded"],Content = Text.ToBinary(BuildQueryString)]))
in
BuildQueryString
The error with below already occurs:
Details:
Value=[Record]
Type=[Type]