Integration - Consuming Salesforce Data

By in
Integration - Consuming Salesforce Data

Integration – Consuming Salesforce Data

Many times, it’s necessary to consume external APIs to either send or receive data in Salesforce. This helps multiple systems to be in sync with each other.

Rest call from Salesforce

Image Source: Apex Integration on Rest Callouts

API basics

API stands for Application Programming Interface. It’s used as a base for 2 systems to talk with each other. Common methods to communicate using API are SOAP API and REST API. The most common one that is widely being used is REST API.

Callouts for REST are based on HTTP. It’s useful to have a basic understanding of HTTP to comprehend how callouts function. There is an endpoint and an HTTP method assigned to each callout request. The HTTP method specifies the desired action type.

GET requests are the most basic requests (GET is an HTTP method). A GET request expresses the sender’s desire to learn more about a resource from the server. When the server receives and completes this request, it sends the recipient the request details. A GET request is comparable to using the browser to get to an address. Behind the scenes, the browser sends a GET request whenever you access a web page. The outcome of the navigation is a fresh HTML page that is seen in the browser. The response object is what happens as a result of a callout.

HTTP Method Description
GET Obtain information from a URL.
POST Publish data to the server or create a resource.
DELETE Remove a resource that has a URL.
PUT The resource given in the request body should be created or changed.


In this way, it’s important to know the basics of integration while implementing HTTP methods. When the server completes the request processing, a status code is sent in the response. The status code reveals whether the request was successfully handled or whether mistakes were made. The server sends a status code of 200 in response to a successful request. Other status codes like 404 for a file that was not found and 500 for an internal server issue are probably ones you’ve already encountered.

Additional Resources:

Cover Image by Racool_studio on Freepik