Scripted REST API help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 06:37 AM - edited 10-17-2024 07:25 AM
Hello all,
Good evening.
I have gone through the Scripted REST API docs, and I understand from it like, if we want to create our own APIs, then we will be going with it.
and currently, a guy from the third-party tool is using the catalog item to raise a request from Service-now and while he is passing the Requested for and some other reference field referencing to User table, the data is showing up in the sys_id. So, at their side, he said they are not reference fields.
So, my lead told me to go with scripted REST APIs.
So, now MY UESTION is,
Can someone tell me in what scenario exactly, do we use Scripted REST API and
1) Why it is useful and what it does differently??????
2) More importantly, what is the help of Relative Path in the Scripted REST API?
3) And how does the API Name space is populating automatically and on what basis?
Can someone help me here please?
Note: currently I am going through this:
My experience with Scripted Rest APIs and some goo... - ServiceNow Community
End point is third-party tool URL right?
4) So, here what is something like, creating custom End point URL ?
Why?
Regards,
Lucky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 08:21 AM
Hi @Lucky1 ,
Let me answer you query here.
1) Why it is useful and what it does differently??????
Ans: Scripted rest API is useful when third party want you to send specified data with some manipulating the value before sending.
2) More importantly, what is the help of Relative Path in the Scripted REST API?
Ans: While creating or editing a Scripted REST Resource, you can define a Relative Path.
For example: /incident/{sys_id}.
In this example, {sys_id} is a variable placeholder that you can replaced with an actual value before making the API call.
3) And how does the API Name space is populating automatically and on what basis?
Ans: API Namespace is automatically generated when you create a Scripted REST API, and it serves as a unique identifier for your API.
- The API Namespace ensures that the REST API you create is uniquely identifiable in the system, preventing conflicts with other APIs.
- It is immutable once the API is created. You cannot change the API Namespace later, even if you modify the API Name.
4) So, here what is something like, creating custom End point URL ?
Ans: refer ans 3.
For detailed information you can visit this blog: https://servicenowwithrunjay.com/scripted-rest-api-servicenow/
Please Mark Correct if this solves your query and also mark Helpful if you find my response worthy based on the impact.
Regards,
Runjay Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 07:25 PM
Hello Runjay,
Thanks a lot for your clear explanation.
Scripted rest API is useful when third party want you to send specified data with some manipulating the value before sending.
Here can you give me some example of manipulating the value before sending?
Regards,
Lucky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2024 10:49 PM
Hi @Lucky1 ,
In both case scripted rest api is useful while integrating with third party tool. Sometime you have to send some data after manipulation or some time after receiving the data and before onset/update to actual table you have to do manipulation.
Example: let’s say third party tool require employees’s manager name or cost center of employee on that case table api won’t help you. If you write the script to get manager name and cost center name from respective table and add in json.
i hope it is clear to now.
Please Mark Correct if this solves your query and also mark Helpful if you find my response worthy based on the impact.