The CreatorCon Call for Content is officially open! Get started here.

REST API - Asynchronous Inbound flow to return sys_id

CV1
Tera Contributor
Hi Everyone,
We are using REST API - Asynchronous trigger (post) and created an Inbound flow.
The requirement is after the payload from a 3rd party application is inserted to SN  table, we need to do the following :
 
Call to ServiceNow endpoint will return the sysId
{
   "sysId": "SN SysId"
}Error response
{
   "error": "description of error"
}PUT:
 
Please Note: Currently its only returning the execution id. How can this be changed to return a specific HTTP response code (200/201/400/500 etc.,)
 
Thanks in advance! 
 
 
 
11 REPLIES 11

Jugmaz
Kilo Sage

getStatusCode()

so when you execute the command, you should be able to get the Status code back from it.

please see eg: Rest API

Jake

mhieron
Tera Contributor

Hey @CV1 ,

did you manage to get the sys_id to the output instead of the execution id?

Regards,

Magnus

Yogesh Verma1
Tera Contributor

Hi @CV1,

 

Did you manage to send back the custom response? If yes, please explain.

Jugmaz
Kilo Sage

When you execute the code that you have defined there in the Web Service, you should be able to define the REST Response which can Include whatever details you have!
You need to do that in one transaction BEFORE rest response sent.

please read the REST descirption from ServiceNow.