Activity Forums Salesforce® Discussions What is the use of HTTP POST in Salesforce?

  • Anurag

    Member
    July 17, 2018 at 11:49 am

    Hello Sanjana,

    There are various methods used while making a callout through HTTP. The HTTP-'POST' method is used when we are to post a data to the server or create a resource for a client to use.

  • Parul

    Member
    September 14, 2018 at 6:46 am

    The @HttpPost annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP POST request is sent, and creates a new resource. To use this annotation, your Apex method must be defined as global static.

     

    Thanks.

  • shariq

    Member
    September 14, 2018 at 12:25 pm

    Hi,

    Making your Apex class available as a REST web service is straightforward. Define your class as global, and define methods as global static. Add annotations to the class and methods. For example, this sample Apex REST class uses one method. The createRecord method is a custom REST API call. It’s annotated with @HttpPost and is invoked for a POST request.

    @RestResource(urlMapping='/Account/*')
    global with sharing class MyRestResource {
    @HttpPost
    global static Account createRecord() {
    // Add your code
    }
    }

    Hope this helps!

  • Avnish Yadav

    Member
    September 14, 2018 at 12:44 pm

    Hey,

    We can use HTTP POST in Salesforce to push or create new resources.

    Thanks.

  • Pooja

    Member
    February 27, 2020 at 2:30 pm

    HTTP POST in Salesforce is used to take the data from the resources.

  • Pooja

    Member
    March 6, 2020 at 1:55 pm

    The @HttpPost annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP POST request is sent, and creates a new resource.

Log In to reply.

Popular Salesforce Blogs