- August 14, 2019 at 12:53 pm #61037Gursimran Singh #59
what is the difference between post and put in Salesforce?
what is the difference between post and put in Salesforce?January 16, 2020 at 1:29 pm #66926Anjali #17
All these annotations are used at the Method level and enables us to expose an Apex method as a REST resource. And here are the differences –
HttpPut – Used for Create and Update
HttpPost – Used for Create
and there is another method also present- HttpPatch – Used for Update
So if you only wish to create a new record then you can use HttpPost. If you wish to first check if a record exists and only when it does not exists then create a new record, use HttpPut. And if you are sure that the record exists and in case it does not then you wish to throw error then use HttpPatch.
Hope this helps!
Please Register to reply to this topic. /