- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 03:59 AM
I have used GET and POST HTTP methods to integrate two PDI between. But I need to add PATCH and DELETE Methods also for this PATCH method i dont want give sys id in Endpoint URL itself. Instead of that is there anyway to pass sys id.
If i mentioned sys id in url itself then it will applicable only to one sys id
i want to give dynamic sys id.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 08:46 AM
Hi @Aditya02
To use the PATCH method in ServiceNow without specifying the sys_id in the endpoint URL, you can pass the sys_id dynamically in the request body or as a query parameter. Here’s a summary of how you can achieve this:
Using Request Body:
- Include the sys_id in the JSON payload of your PATCH request.
- Example:
{ "sys_id": "your_sys_id", "field_to_update": "new_value" }
Using Query Parameters:
- Pass the sys_id as a query parameter in the URL.
- Example URL: https://your_instance.service-now.com/api/now/table/incident?sys_id=your_sys_id
- Ensure your script or integration logic extracts the sys_id from the query parameters.
ServiceNow Scripted REST API:
- Create a Scripted REST API in ServiceNow to handle PATCH requests.
- In your script, dynamically handle the sys_id from the request body or query parameters
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 02:27 AM
Hi @Aditya02
To use the PATCH method in ServiceNow without including the sys_id in the endpoint URL, you can send the sys_id either in the request body or as a query parameter. Here’s how to do it:
1.Using the Request Body:
Include the sys_id in the JSON payload of your PATCH request.
For example:
{
"sys_id": "your_sys_id",
"field_to_update": "new_value"
}
2.Using Query Parameters:
Add the sys_id as a query parameter in the URL.
For example:
https://your_instance.service-now.com/api/now/table/incident?sys_id=your_sys_id
Make sure your script or integration logic can extract the sys_id from the query parameters.
ServiceNow Scripted REST API:
- Create a Scripted REST API in ServiceNow to handle PATCH requests.
- In your script, dynamically retrieve the sys_id from either the request body or query parameters.
Thanks, and Regards
Vishaal
Please mark this response as correct or helpful if it assisted you with your question.