What is the difference between the PUT and PATCH methods in the REST API integration

Shantharao
Kilo Sage

What is the difference between the PUT and PATCH methods in the REST API integration

1 ACCEPTED SOLUTION

Anand Kumar P
Giga Patron
Giga Patron

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

View solution in original post

6 REPLIES 6

@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