How can I send a Rest message request where the same query parameter is used more than once?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 12:26 PM
I need to send a post request where the query parameter "interaction-id" is used multiple times. I've tried using rest.setQueryParameter("interaction-id", "value"), but that just overrides the same value instead of appending it to the request multiple times. any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 08:47 PM
Hi @mpsteve137
Do you want to pass multiple values of interaction-id in a POST request ?
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 10:15 PM
Hi @mpsteve137
In ServiceNow's RESTMessageV2 API, calling rest.setQueryParameter("key", "value") multiple times for the same key will override the previous value. To include the same query parameter multiple times, you need to append them manually to the endpoint URL instead of using setQueryParameter.
Instead of using setQueryParameter, construct the full URL with all the repeated query parameters.
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2025 10:34 PM
why are you having 2 query parameters with same name?
it will override with the latest one
Please check with the 3rd party whose API you are consuming and ensure the query parameter is correct and unique.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader