Rest query parameters in array form?

rita_m
Tera Guru

Hi -

 

We've had a custom pagerduty integration now for many years, and we need to keep using it because we've made one with different features than what the one in the app store offers.

 

With Pagerduty's new upgrade from REST API V1 to V2, we can no longer send a query parameter in comma separated format.  Instead, they want it in an ARRAY!

 

How can I set up an HTTP Query Parameter as an array?

 

doing

fieldname[]

in the parameter name field doesn't work. 

 

I've tried

fieldname

and then

[${value}]

but no luck with that, either.

 

Any ideas?

 

Thanks!

8 REPLIES 8

I don't think you should use that plural format, I think the correct one should be either just status[] or status_ids[]

Can you try these two formats?

Sagun
Kilo Explorer

Hi Rita,

Were you able to solve the issue? If so, could you please share how did you resolve it?

I am running into similar issue and trying to look for solution and haven't had any luck yet.

Any information would be helpful.

Thank you,

Sagun

theBeastMaster
Mega Guru

Hi Rita,

 

Did you ever find a workaround to it?

Shlomi Kayra
Tera Contributor

Maybe that's because you tried to send your paramters through the Query Parameter, try to send your parameters from the body of your request and it will work fine. 

 

in your Scripted REST API script get your parameter like this: 

 

var reqBody = request.body;

var reqData = reqBody.data;

var array = reqData.array; 

 

Hope this will help those who are facing this problem now.