[SalesForce] What’s the difference between an HTTP Request Message and a Salesforce Rest Resource and the HttpRequest class

I am new to HTTP and Salesforce's APIs

What is the difference between the salesforce rest resource they talk about in this trailhead module – https://trailhead.salesforce.com/content/learn/modules/api_basics/api_basics_rest
and an HTTP request message? There's also the HttpRequest…. I am not sure how they all fit together

Best Answer

This classifies as a very broad question, but some of these pointers should help.

HTTP, REST, HTTP Messages are all inter-related yet different.

HTTP is a protocol used to communicate between client and server to fetch resources.

HTTP is a protocol which allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and a client-server protocol, which means requests are initiated by the recipient, usually the Web browser.

HTTP Message is term used for the data exchanged between client and server. HttpRequest is one such data which is sent to the server by a client while making a request, and that HttpResponse is the other set of data which is sent back to the client from the server.

HTTP messages are how data is exchanged between a server and a client. There are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server.

A Salesforce REST Resource is a resource exposed as an API (imagine an Apex class annotated with @RestResource) which is exposed to return certain data based on certain request based on the HTTP protocol and utilizing the HTTP Messages (HttpRequest/HttpResponse) as the component for data exchange. You can find more on REST here.

Related Topic