• #29668
    Salesforce | Sanjana Sanjana #13
    Forcetalks

    What is the use of HTTP POST in Salesforce?

    What is the use of HTTP POST in Salesforce?

    Tagged: , , , ,

    #29954
    Forcetalks

    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.

    #34071
    Salesforce | Parul Parul #1
    Forcetalks

    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.

    #34117
    Salesforce | shariq shariq #2
    Forcetalks

    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!

    #34120
    Forcetalks

    Hey,

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

    Thanks.

Viewing 5 posts - 1 through 5 (of 5 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?