How to make parallel (simultaneous) API calls?

Smith Johnson
Tera Guru

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.

3 REPLIES 3

Community Alums
Not applicable

HI @Smith Johnson ,

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

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. 


Hi @Smith Johnson ,

Were you able to figure out the solution for this?