Forum Discussion
Json POST Request through each row
Hi,
New query user here. I have a table with one column as "start date", and the second column as "end date". I need to make JSON POST query using the two dates as parameters to be passed through in a JSON body. How do I make POST query for each row and combine all data in a single table?
I know how to make a single working query, but how do I loop through each row in advanced editor? I have done some research, but i couldn't find similar situations using more than one columns as parameters. My working query is like this:
let
url = " http://www.xxx.xxx/..... ",
headers=[#"accept"="application/json", #"Content-Type"="application/x-www-form-urlencoded"],
PostBody = [
user_id = "lasf3sd5423e1dsd2asdsdsdf",
startTime = DateTime.ToText("2022-03-01", "yyyy-MM-dd h:mm"),
endTime = DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd h:mm")
],
response = Json.Document(Web.Contents(url,
[
Headers = headers,
Content = Text.ToBinary(Uri.BuildQueryString(PostBody))
]
)),
In
response
Thank you!
1 Reply
- AnonymousNot applicable
Hi SJMC_LAB ,
This is the related document, you can view this content:
https://gorilla.bi/power-query/list-generate-api-calls/
https://community.powerbi.com/t5/Power-Query/Request-POST-with-Json-Body/td-p/1959792
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.