Posts

Showing posts from December, 2020

POST - PUT - PATCH

POST - PUT - PATCH methods have very close analogy with Salesforce DML statements. POST <=> INSERT operation PATCH <=> UPDATE operation PUT <=> UPSERT operation Like inserting the same resource twice is allowed, POST method can create duplicate resources.  Resource can be partially updated with PATCH method.  But, there is bit difference in PUT methods. complete resource must passed to even if the resource needs to be updated partially. Lets take an example, Resource: { "id" : 1234 , "day" : 15 , "month" : 10 , "year" : 2020 } Body for POST method: { "id" : 1234 , "day" : 15 , "month" : 10 , "year" : 2020 } Let's update the day from 10 to 15 Body for PUT method: { "id" : 1234 , "day" : 15 , "month" : 10 , "year" : 2020 }