Salesforce can interact with third-party tools (Workbench, Postman, etc.) using Salesforce APIs. It is a simple, secure and powerful way to get access to salesforce org data. Salesforce APIs provide Rest API, Soap API, Streaming API, Bulk API, and Chatter API, etc. All has its own functionality. Now we have Challenge that where we should use which API. Below is the explanation for some APIs
What is Rest API?
Rest API is a simple and powerful web service. It gives access to your org data in the format of XML or JSON. For example, you can create, update, read and delete (CRUD) your data. Apart from this you can search or retrieve your metadata or query your data. APIs in salesforce is a lightweight request and framework and is easy to use. It is an excellent technology for mobile applications and web projects. Rest API follows synchronous communication and return data in the form of XML and JSON according to our choice.
Come to Salesforce Soap API?
Soap API is also a simple, secure and powerful web service to interact with salesforce, but it retrieves data in the form of XML. It is also use to create, read, update and delete record on different objects. We can use Salesforce APIs in any language which supports web services. As we all know JSON object is lightweight, so, whenever we are interested in lightweight data, we prefer to use Soap API instead of Rest API.
What about Bulk API?
It is specialized Restful APIs in salesforce for loading and querying lots of data at once. It means we can retrieve 50,000 or more records at a time. It is asynchronous in nature. We preferred this approach when we deal with a large amount of data. We have two versions of the Bulk API (1.0 and 2.0). Both versions handle a large amount of data.
Bulk API is best when our task involves lots of records, like the loading of data into your org for the first time.
Let’s talk about Streaming API!
Streaming API is also specialized Salesforce APIs for setting up notifications that trigger when changes are made to your data. It enables the streaming of events using push technology and provides a subscription mechanism. Subscription API supports multiple types of events, generic events, platform events and Change Data Capture events.
It is best to use Streaming API for applications that require general notification of data change in an org to reduce the number of APIs in Salesforce calls and improve performance.
Push Technology – Push technology, also called publish/subscribe model. It helps to transfer information that is initiated from a server to the client. It is the opposite of pull technology. In pull technology, request for information is made from client to server.
Message Reliability- Streaming API provides reliable message delivery by enabling you to replay past events through streaming, this feature involves API version 37.0 or later. The client subscribed with API version 36 or earlier, we might not receive all message.
Message Durability– Through Salesforce APIs version 37.0 and later you can retrieve events within the retention window through durable Streaming.
Which API should I Use When?