How to trigger Outbound GET REST API if there is an Inbound call

Mrman
Tera Guru

Hi All,

My use case requires to call external REST API from ServiceNow and the get additional field details when that External system makes a call to  ServiceNow by passing some basic details of the user.  For example, the 3rd party system trigger a call to Service Now when they hire a new candidate in their system and pushes the ID of that user.  Once the initial call is made, based on that User ID they pass we need to go and GET the additional field details like their First name , last name , email, etc...and store in a table.

Please let me know possible solutions to achieve this in Service Now using REST API and our 3rd party system supports REST API with JSON.

 

@Ankur Bawiskar 

1 ACCEPTED SOLUTION

Hi,

Example

1) create scripted REST API in instance B

2) now instance A will call that

3) in the scripted REST API created in instance B do whatever processing you want

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Hi,

Example

1) create scripted REST API in instance B

2) now instance A will call that

3) in the scripted REST API created in instance B do whatever processing you want

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar I tried creating the scripted rest API in one service now instance and then tried calling it from other instance . 

Now my actual requirement as I explained in description , once the instance B calls scripted API in instnace A , firstly I need to get the user ID and then based on this User ID I need to again call the instance B to get the additional details of this user and the process in instance A .

Please let me know how to achieve this.

Hi,

you will have to create some API in instance B to fetch the details

OR

you can use OOB table API on sys_user table to fetch the details

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  Thanks for your response . 

please let me know how can I make this GET request from the same scripted API in instance A , to summarize once instance B calls scripted API and passes user ID , how to call the table API in instance B to get additional details from the same scripted API in instance A .

Hi,

you can consume the instance B API using REST Message in scripted rest api

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader