Activity Forums Salesforce Discussions what is the difference between post and put in Salesforce?

Tagged: ,

  • what is the difference between post and put in Salesforce?

  • Gursimran Singh

    Member
    August 14, 2019 at 12:53 pm

    what is the difference between post and put in Salesforce?

    • This discussion was modified 1 year, 1 month ago by  Gursimran Singh.
    • This discussion was modified 1 year, 1 month ago by  Forcetalks.
  • Anjali

    Member
    January 16, 2020 at 1:29 pm

    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!

Viewing 1 - 2 of 2 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos