Activity › Forums › Salesforce® Discussions › What is the use of HTTP POST in Salesforce?
-
What is the use of HTTP POST in Salesforce?
Posted by Sanjana on July 5, 2018 at 1:40 PMWhat is the use of HTTP POST in Salesforce?
Pooja replied 6 years, 2 months ago 6 Members · 6 Replies -
6 Replies
-
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.
- [adinserter block='9']
-
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.
-
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!
-
Hey,
We can use HTTP POST in Salesforce to push or create new resources.
Thanks.
-
HTTP POST in Salesforce is used to take the data from the resources.
-
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.