Using Repeating URL Parameters / Array in REST Resource Query Block

Trying to figure out the best way to tackle this.

Have an endpoint that requires multiple IDs (let say [1,2,3,4,5]) to be passed in the querystring which has the resulting request look like: ....api/campaigns/metrics?campaignId=1&campaignId=2&campaignId=3&campaignId=4&campaignId=5... etc which I believe the is the correct way to serialize an array into url parms. The array length is dynamic and can change from request to request.

Is this possible to achieve with a REST resource query block? Any suggestions otherwise?

Maybe try to serialize the strings in a separate block that outputs the string you want to append and then pass that whole string to a URL variable called “finalString” in the REST query.

1 Like

This is what I ended up doing but I was hoping to avoid the extra block. Thanks for the suggestion!

I bet there is a smart way to write a map right into the variable...Maybe => `campaignId=${id}`).join('&')