Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Table API VS Scripted API

Ansuha Chipuri
Kilo Guru

Hi,

If i have table API to provide web services then what is the use of having scripted REST API?

Thankyou in advance!!!

6 REPLIES 6

Swapnil Soni1
Giga Guru

Hi Anusha,

In addition to above

Since you mention Scripted REST API, I assume you are talking about ServiceNow as a Web Service Provider. The Scripted REST API allows you to script your request handling and response in a complex ad-hoc way. See the tutorial here: Scripted REST API Objectives

 

For me, I use the table apis for simple actions (create read update delete) on a given table. I leverage scripted api's when I'm creating a more complex action. Scripted API's are much flexible and whether you are leveraging pre built ones, or building your own (in a scoped app maybe), scripted API's are for exposing much more flexible and often more complex functions.

 

For instance a scripted api may perform actions against different tables, whereas a table based api allows you access to a single table (though there may be business rules etc triggered by the action)

 

eg Table API on user table to insert a user

Scripted api for create new user, insert user, adds it to a group, sets the manager, sends an email etc

 

Let me know if I am able to suggest to you.

Thanks

Sudhanshu Talw1
Tera Guru

Hii Anusha,

Let me explain a scenario to understand it clearly suppose u want to create an incident on instance A & want to replicate the same incident on instance B but you don't want to keep same sysid's then you should use table api.

 

But if we want to keep sys_id's same then we should create scripted API and pass sysid's as well.you have full fledge control over inputs/outputs & table API is not best in all the cases where we want to control inputs/outputs

Hope it helps!!

 

Thanks

Sudhanshu