function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ujwala Mane 17Ujwala Mane 17 

Rest API Get and POST

Hi all,
1) i am learning REST api. I am not getting difference between @httpGet declaration and when we declare like 
        HttpRequest req = new HttpRequest();
        Http http = new Http();
what is difference between these two declaration.??
2) When we write GET method? when we want to send data from salesforce to other system or when we want to get data from other system into salesforce??

Nubes Elite Technologies Pvt. LtdNubes Elite Technologies Pvt. Ltd
Hi Ujwala,

1)  HttpRequest req = new HttpRequest();
Use the HttpRequest class to programmatically create HTTP requests like GET, POST, PUT, and DELETE. 
               Use the XML classes or JSON classes to parse XML or JSON content in the body of a request created by HttpRequest.
      Http http = new Http();
Use this class to initiate an HTTP request and response.

2) 'GET' request is used to get a resource from a server. If you perform a `GET` request, the server looks for the data you requested and sends it back to you. In other words, a `GET` request performs a `READ` operation. This is the default request method.

For more details, I request you to refer to official documentation by SFDC.

Thank You,
Development | Training | Consulting

Please mark this as solution if your problem is solved.
v varaprasadv varaprasad

Please check once below link for more INFO : (

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support:

Salesforce latest interview questions and training videos :