difference between REST message and scripted RESTAPI?

suvro
Mega Sage
Mega Sage

Hi Friends,

What is the difference between REST message and scripted REST API?

When should we use REST message and when should we use scripted REST API?

Please help me by giving suitable examples.

Thanks and Regards,

Chandra Suvro Bose

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi,



You can go through the below thread where I have explained how to Use Rest and Scripted Rest API for Integration between two instances:



Third party User need to update the RITM(requested item) to service now instance using scripted web ...




You can also go through the below video links for more information on   the above topics:



TechNow Episode 18 | REST API - YouTube


ServiceNow Express | Outbound REST - YouTube



Below thread for Scripted Web Service would also be useful:



Scripted Rest APIs - Part 1


Scripted REST APIs - Part 2



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

5 REPLIES 5

Alikutty A
Tera Sage

Hi,



Rest Message is used for sending outbound updates to an external system from Service Now. If a third party application supports REST then you can send data from Service Now using the rest message.



Create a REST message



Scripted REST API on the other hand enables inbound updates from an external system. If an external system needs to send data to Service Now and if you need to process custom changes(validations etc) which are not supported by OOB REST API's then you can write a scripted REST web service to process inbound requests from external systems.



Scripted REST APIs



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


nayanawadhiya1
Kilo Sage

Hey Chandra,



Refer this -


Allows you to use system defined WEB SERVICE


http://wiki.servicenow.com/index.php?title=REST_API#gsc.tab=0




Scripted REST APIs



Allows to create your own WEB SERVICE.


shloke04
Kilo Patron

Hi,



You can go through the below thread where I have explained how to Use Rest and Scripted Rest API for Integration between two instances:



Third party User need to update the RITM(requested item) to service now instance using scripted web ...




You can also go through the below video links for more information on   the above topics:



TechNow Episode 18 | REST API - YouTube


ServiceNow Express | Outbound REST - YouTube



Below thread for Scripted Web Service would also be useful:



Scripted Rest APIs - Part 1


Scripted REST APIs - Part 2



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hello, 

I need to create a Webservice API where input is: Sys ID of any record and output is: all *related* active records to that sys id. The relationships between the tables is maintained in Relationships under system definition.

Could you please guide me how to implement this? Sample code would be great.

Input: Sys ID of the record 
Output: All *RELATED* active records from *VARIOUS* tables (in the following JSON format):
{
"result": [
{
"Sys ID": "5520267",
"CI Name": "Record 1",
"Table Name": "u_table_a"
},
{
"Sys ID": "5520367",
"CI Name": "Record 2",
"Table Name": "u_table_a"
},
{
"Sys ID": "8331210",
"CI Name": "Record 1",
"Table Name": "u_table_b"
},
{
"Sys ID": "8321210",
"CI Name": "Record 2",
"Table Name": "u_table_b"
},
{
"Sys ID": "3042006",
"CI Name": "Record 3",
"Table Name": "u_table_b"
},
{
"sys_id": "4509847",
"CI Name": "Record 1",
"Table Name": ""u_table_c"
}
{
"sys_id": "4509247",
"CI Name": "Record 2",
"Table Name": ""u_table_c"
}
]
}