- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 05:38 AM
Hi All,
I am using REST API EXPLORER and i selected PUT methods and selected user table and then given one sys id record
then i updated email value and its working --> after sending the rest call --> email id got updated in target table( user table)
then i did the same using PATCH -- > email id got updated
so now the question if both PUT and PATCH are doing the same job , then what is the difference ?
Please provide your inputs
Thank you,
Shabbir Shaik
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 06:10 AM
- Consider there's a record with information like name, email, age, department, role etc.
- The objective is to update age for that record
PUT Method:
- If you use the PUT method, you need to send the entire records' data in the payload even if you only want to change one field.
- If the data populated in the age field has to be updated, the entire record's data from every field like age, department, role, name, email everything has to be sent in the payload of the PUT call to third party. If you leave out any information, it will be erased or set to default.
PATCH Method:
- If you use the PATCH method, you can just send the new age without sending out other information of name, email, department.
- Basically PATCH is to make partial changes for a record.
Breakdown :
PUT : To overwrite the entire record with the changes done at the places desired while data at rest of the places remaining unchanged
PATCH : To make change exactly where it is intended
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 10:41 AM
Hi Shreya,
I got theoretical explanation its very clear , can we test the same with servicenow REST API Explorer / POSTMAN ?
Thank you,
Shabbir Shaik