What are Salesforce APIs?
Salesforce provides programmatic access to the organization’s information using simple, powerful, and secure application programming interfaces [API’s].
An API allows different components to interact. Most automation makes heavy use of these lists of commands to connect and integrate.Salesforce can also call API’s to retrieve data from other systems or services, as shown in Fig. 1.1.
We have got a series of APIs, and at present salesforce supports 10 API’s and each of them has its different use case.Though, they all have a similar purpose i.e. of accessing data from Force.com or Database.com, yet there are some key differences too which are worth explaining. First, it’s important to note that all these APIs operate identically across Force.com and Database.com.
Fig 1.2 API Series
- SOAP API:It is useful to integrate the Salesforce org data with other application using SOAP.
- REST API:REST API is useful to access objects in the Salesforce organization using REST.
- Bulk API:It is based on REST principles and is optimized for loading or deleting large sets of data.
- Metadata API:Helps to retrieve, deploy, create, update, or delete customizations for the org. Commonly it is used to migrate changes from a sandbox or testing org to the production environment.
- Tooling API:Use to build custom development tools or apps for Salesforce Platform applications.
- Streaming API:It is useful for applications that require general notification of data changes in an organization.
- Apex REST API:It is useful to build your own REST API in APEX.
- Apex SOAP API:This API is useful to create custom SOAP web service and exposes Apex Classes as SOAP web service.
- Chatter REST API:These API’s are used for Chatter feeds, users, groups, and followers.It provides programmatic access to files, recommendations, topics, notifications, Data.com purchasing, etc.
- com API:It provides 100% complete, high quality data, updated in real-time in the cloud, and with comprehensive coverage worldwide.
- REST API Callouts
REST callouts are based on HTTP. Callout request is associated with an HTTP method and an endpoint, and, this HTTP method indicates what type of action is desired.
- GET request (GET is an HTTP method) is the simplest request. As, GET request is similarto navigating to an address in the browser. At the time, when you visit a web page, the browser performs a GET request behind the scenes.
Salesforce Integration from one org to another using REST API Callouts
For implementing this integration from Source org to Target org, we need to perform some activities in Target Org and Source Org.
Step 1: We need to perform below activities in Target org.
- Create a Connected App
In order to authenticate an external application with Salesforce, we need to create a connected app to inform Salesforce about the new authentication entry point. Connected app uses standard OAuth 2.0 protocol to authenticate.
- Create Rest Web Service to fetch data based on the requirement of SOURCE org and send it back to SOURCE org.
Step 2:And, for the Source org below pointersneeds to be done.
- Create an apex controller.
- Create a Visualforce page.
- Create a remote site setting for the URL of Target Org.
In this way, you will be able to get the list of Accounts of Target org into Source org.
Benefits of Salesforce Integration using REST API Callouts
- Salesforce Rest API is easy to work with and has simple integration and HTTP requests.
- It has shown remarkable success in the enterprise customer level which cannot be countered.
- It is a perfect choice of technology that can be used with mobile applications and Web 2.0 projects.
- It has lightweight requests and responsive framework.
- The API pushes and pulls the information between Salesforce and the desired destination. Data entry is time-consuming and repetitive. If the reps are spending valuable time in data typing instead of helping the customers, anything we can do to give them that time back is helpful.
Now, we understand how Salesforce API Integration works, as well as how it is relatively easy to set up if we know what we are doing. Salesforce APIs can work alongside most of the other apps we use on a regular basis. They can bring several differentbenefits; the biggest of them is leaving sales reps with sufficient time so that they can serve their customers in a better way.