Servicenow PDI to PDI Integration

Aditya02
Tera Guru

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.

1 ACCEPTED SOLUTION

thullurishalini
Kilo Guru

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:

  1. 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"
      }
      
  2. Using Query Parameters:

  3. 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
       

 

View solution in original post

5 REPLIES 5

VishaalRanS
Tera Guru

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:

  1. Create a Scripted REST API in ServiceNow to handle PATCH requests.
  2. 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.