- July 12, 2018 at 12:50 pm #29847shradha jain #6
What is the difference between PUT and POST methods of REST API in Salesforce?
What is the difference between PUT and POST methods of REST API in Salesforce?July 30, 2018 at 11:11 am #30627
HTTP.POST can be used when the client is sending data to the server and the server will decide the URI for the newly created resource, whereas HTTP.PUT can be used when the client is sending data to the server and the client is determining the URI for the newly created resourceSeptember 18, 2018 at 11:21 pm #35150shariq #1
POST is used to create a new entity. “Post” means “after”; if you have a collection of entities and you tack a new one onto its end, you have posted to the collection. You can’t post an existing entity, and it’s common (though not always required) to use the collection’s URI to post. (E.g. you would create a new Quora user named Noah by POSTing to https://quora.com/users as opposed to https://quora.com/users/noah.)
PATCH is used to update an existing entity with new information. You can’t patch an entity that doesn’t exist. You would use this when you have a simple update to perform, e.g. changing a user’s name.
Finally, PUT is used to set an entity’s information completely. PUTting is similar to POSTing, except that it will overwrite the entity if already exists or create it otherwise. You could use a PUT to write a user to your database that may already be in it.
Hope this helps.
Please Register to reply to this topic. /