Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
crossover
Advocate I
Advocate I

HTTP POST call with dynamic JSON array

Hello,

I'm having problems loading values into JSON array for HTTP POST call over PQ. Raw JSON body is quite simple:

json_example.jpg

 

 

 

 

By hardcoding this in M, POST-call works fine:

let
    Source = Json.Document(Web.Contents("https://api.mytest.com/case/666d8380-7a76-410c-8eeb-b94d7248fb96/revoke-me",
	[Headers=[#"Content-Type"="application/json", #"x-token"= myKey], Content= Json.FromValue([
 
    template = "string",
    case_ids = {"5e76fcaf-2e27-4c0a-a14b-6ce05b9e79f3", "8b801bdb-1f46-4548-80e0-7a4e0b6978a2"}
    //case_ids = {myInput}
	
	])]))
in
    Source

 

But here is the problem. While hardcoding the array works fine, I need to keep it dynamic and load values through parameter in a dynamic way, like the commented-out case_ids = {myInput}

Drilled down data would be coming from Excel named range or table. My go-to option has been to drill down the value as additional data connection (myInput) and then use as input parameter. Parameter drill down output looks like this to mimic how JSON array looks like:

 

myinput_example.jpg

Using this as input will NOT work and API doesn't recognize it being a collection of two separate values which it should process one-by-one. With that being said, when I'm only passing a single value - not multiple concatenated values through myInput parameter, it does work fine:

 

myinput_single.jpg


This will indeed keep the query parameter dynamic, however given there can be several values that need to be processed, I'd need to run the query several times. But there's surely a better way?

 

What am I doing wrong in passing those multiple values to JSON array? 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @crossover ,

 

Please refer to the following blog:

https://blog.crossjoin.co.uk/2021/01/10/handling-multiple-url-query-parameters-with-the-same-name-us...

It introduces how to andl multiple URL query parameters with the same name using Web.Contents.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

crossover
Advocate I
Advocate I

I tried adding several separate parameters to send a single value through each - this works again, which at least decreases the amount of queries needed, though still not that flexible. And further suggests it's likely a data concatenation issue.

 

case_ids = {input1, input2, input3}

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.