How to make parallel (simultaneous) API calls?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 11:30 PM
Hello,
I have a use case where I want to make 4 api calls to the same endpoint (with different query parameter each time). Now, what I do is it to make the 4 calls sequentially in a script include. However, this causes huge delays.
Is there a way in server-side SN to make 4 API calls in parallel?
Any ideas are highly welcomed.
Smith.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 11:40 PM
HI
You can create an event and perform the actual processing in the Script Action associated with the event. And wait for all the events to be processed.
Refer to these threads:
https://community.servicenow.com/community?id=community_question&sys_id=fb73cf25dbd8dbc01dcaf3231f9619a0
and
https://community.servicenow.com/community?id=community_question&sys_id=50654611db29ab00d6a102d5ca961987
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 11:43 PM
Hi Sandeep,
thanks for your idea.
I have a concern.
Should I trigger 4 different events from my script include? If yes, then I will have four different script actions? And then, can the script actions return the response of each call back to my script include??? I want only to continue the rest code of the script include if I have the responses of all API Calls.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2024 02:39 AM
Hi @Smith Johnson ,
Were you able to figure out the solution for this?