logo

NJP

What is Scripted REST API in ServiceNow | 4MV4D | S01L07

Import · Feb 15, 2020 · video

[Music] in order to subscribe to my channel please click here or click here please share comment and like my videos and channel hey guys this is god of welcome to ServiceNow four-minute video for developers we are continuing with series one that is for a rest integration and this lesson number seven is about a scripted REST API what is a scripted REST API ServiceNow gives you a feature for customizing REST API and that's called a scripted REST API it allows developers to build custom web services API developers can use a scripting to manage request and response so it might happen the third-party application might need some data with some customized way maybe out of the box may be table API is not able to fulfill that particular request in that case you use a scripted REST API is in service now you have a specific module that is a script addressed api's are the system web services when you will click on that module you will see all the out-of-the-box scripted web services which have been created by a service now all those custom scripted api is it scripted uri now the important part of scripted web services scripted rest api is uri that means which is given to your consumer so that it can head to your instance as you can see we are starting with the first part of the uri that is instance name so here you will put your instance name whatever name you have and that is instance dot service - now calm then you have slash API this will be by default and then you put namespace now namespace is basically the scope so if you are in global scope then you will have like a company code in this particular place or if you are creating a API for any any private scope then you will have that scope name over here then we have version so this will define the versioning of your API then we have API ID that is value of API ID so while creating this scripted web service you will have this API ID here and the last part is a relative path that means it's kind of a resource path that which resource you want to connect to that's what you define and that gives you the relative path a scripted API configuration now as I mentioned that you can create a scripted API in ServiceNow so it gives you an opportunity so let's see what kind of different configuration you have to do for creating a scripted web service scripted REST API so as you can see we have opened this a scripted REST API form that is first field is name where you will mention the name of your escape terrorists API then you will put the API ID now this will be displayed in the URI which will be given to the consumer then you have active inactive if you want to make it active inactive then we have protection policy it's as related to the who should access not just that I'm not talking about the URL it's just kind of a protection policy as part of the scope perspective then we have application whether it's like global scope or private scope then we have API namespace now we were talking about the namespace where you mentioned the scope it can also show you the scope of the application you're working on and that's how you can see here now then we have base API pot now this is the base pot which you have to give to your customer or consumer and then you will have the relative path but before that you will have this base path when you will design the URI for your consumer then we have security tab where you will mention the security that means how exactly people will access this particular API so there is a default ACL and if you will see it says application service Maps admin that means those are the admins those those can access this API they should have that particular role the user should have that particular role then we have content negotiation when I talk about the content name of the negotiation in that case now in what format you want request in what format you want response that's what you could mention over here then we have little bit documentation that what exactly this scripted rest service is about and then any kind of documentation link you wanna mention you can mention here then we have some related lists like inci resources now this is the important section where you define the resources where you mention and what kind of data people all kind of activity they will do for example you can see we have HTTP method post now if you if they will use this particular resource they'll be able to do post they will be able to insert some data and with that particular relative path then we have a request headers so if you want specific headers in that case you can mention here and if we have any query parameters so if you want to utilize any query parameters you can mention over here then we have a script addressed resource so as I mentioned now resource is the important factor as part of your caris web services because when we will when you will define the source then consumer will be able to use that particular resource for a particular activity so for example if you will see now this particular resource is for create or update so the method we have used is post then you mention the resource path that what exactly this resource path would be and it also shows the relative path and then it an option to do a scripting and that's the reason we say it a scripted web services now whatever data consumer is looking for you can mention and do your scripting and return in requests or response accordingly so you can manage your request and response with the help of this scripting that's how you do this API configuration thanks for watching my video if you have any questions please put in the comments thank you

View original source

https://www.youtube.com/watch?v=cwz8fWTWbBY