Salesforce can interact with third party tool (Workbench, Postman etc.) using Salesforce APIs. It is simple, secure and powerful way to get access of 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 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 lightweight request and framework and is easy to use. It is an excellent technology for mobile application and web projects. Rest API follow synchronous communication and return data in the form of xml and json according to our choice.
Come to 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 light weight, so, whenever we are interested in light weight 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 large amount of data. We have two version of Bulk API (1.0 and 2.0). Both versions handle large amount of data.
Bulk API is best when our task involves lots of records, like loading of data into your org for the first time.
Let’s talk about Streaming API!
Streaming API is also a specialized Salesforce APIs for setting up notifications that trigger when changes are made to your data. It enables streaming of events using push technology and provides a subscription mechanism. Subscription API supports multiple type 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 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. 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?