- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 10:45 PM
What is the difference between the PUT and PATCH methods in the REST API integration
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 10:51 PM
Hi @Shantharao ,
PATCH
• Updates only specific fields in an existing record.
• If the record doesn’t exist, the PATCH method will fail (e.g., 404 Not Found).
• Think of it as editing just one or two pieces of information in a record.
Example:
If there’s an incident with Number: INC0001234 and you want to update just the Short Description field:
PATCH /api/now/table/incident/INC0001234
Request Body: { "short_description": "Updated Short Description" }
This updates only the short description while leaving other fields, like the priority or state, unchanged.
PUT
• Replaces the entire record with new information.
• If the record doesn’t exist, PUT will create it.
• Think of it as rewriting all the fields of a record.
Example:
If there’s an incident with Number: INC0001234, and you want to completely replace it with new data:
PUT /api/now/table/incident/INC0001234
Request Body: {
"short_description": "New Short Description",
"priority": "2 - High",
"state": "In Progress"
}
This will replace all fields of the record with the new data provided. If INC0001234 doesn’t exist, it will create a new incident with this data.
Key Difference:
PATCH: Updates only the fields you specify. Example: Changing just the Short Description of an incident.
PUT: Replaces the entire record. Example: Rewriting the incident with new values for Short Description, Priority, and State.
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 11:01 PM
@Anand Kumar P
Thank you for the quick response with clear difference between PUT & PATCH,
I have basic knowledge of integrations, could you please provide me a blog or YouTube channel to increase my knowledge in the integrations space
Thanks in advance for your response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2024 11:28 PM
Hi @Shantharao ,
Servicnow doc—https://www.servicenow.com/docs/bundle/xanadu-api-reference/page/integrate/inbound-rest/concept/c_RE...
Rest api YouTube link—https://youtube.com/playlist?list=PLzTvAeLiW8Ae4-8eJWNhzFyTqovD9LaaR&si=M-8LVO0KNSN7MCCw
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand