In an earlier blog SOAP API – Mortgage Banking Technology | Origination Strategy Consulting (takefiveconsulting.com), we covered the basics of SOAP API. In this article we will dive into the functionalities of two other commonly used APIs, the REST API and the BULK API.
- REST stands for REpresentational State Transfer.
- It is a light weight alternative to SOAP, and hence preferred by modern web & mobile based applications.
- It allows programmatic access to the Salesforce data such as records, collections of records, query results, metadata, or API information. Each resource is exposed by a uniform resource identifier (URI) and is accessed by sending HTTP requests to the corresponding URI. .
- A typical HTTP request consists of these elements.
- URI (Uniform Resource Identifier)
URI is the path to a resource. Basic structure of a URI is https://MyDomainName.my.salesforce.com/services/data/vXX.X/resource/
- HTTP method
REST API supports standard HTTP request methods
HEAD, GET, POST, PATCH, PUT, and DELETE
Headers are used to pass parameters and customize options for HTTP requests. Common headers include:
Conditional request header
- Request body
A request body is a rich input that can be included in the request to provide additional information, such as field values for creating or updating records. It can be in JSON or XML format.
How to use REST API?
- Sign up for a developer edition of Salesforce.
- Verify that the user profile has API Enabled permission.
- Set up Authorization using the connected app which is residing in Salesforce. A connected app requests access to REST API resources on behalf of the client application. For a connected app to request access, it must be integrated with the org’s REST API using the OAuth 2.0 protocol. OAuth 2.0 is an open protocol that authorizes secure data sharing between applications through the exchange of tokens.
- Now connect REST API to Salesforce using OAuth.
- To initiate an authorization flow, a connected app on behalf of a client app requests access to a REST API resource.
- In response, an authorizing server grants access tokens to the connected app. You can make REST requests from any HTTP sender. Postman app is one among those.
- A resource server validates these access tokens and approves access to the protected REST API resource.
- Optimized for loading or deleting large sets of data.
- Can operate on many records asynchronously.
- Well suited when looking to process >2000 records.
- Bulk API is REST-based, the request takes the familiar form of a REST request with four components: URI, HTTP method, headers, and body.
URI will be like:
- Bulk API uses the same framework that the REST API uses, which means that Bulk API supports many of the same features, such as OAuth authentication.
/jobs/ingest indicates that you’re accessing the resource for creating Bulk API jobs.
- Bulk ingest jobs allow to upload records to the org by using a CSV file representation.
- Bulk query jobs return records based on a specified query. In a single bulk job, only one object can be processed and only one type of action can be used(insert, update, upsert or delete).
To learn more about Salesforce data APIs, check out the link here API Library | Salesforce Developers
Looking for more information on REST and BULK APIs, leave us a message.
Take Five Consulting is a technology company, based in Virginia U.S., that specializes in the Mortgage Banking vertical especially LOS implementation and application development. Take Five Consulting creates and implement mortgage technology and software specifically for Mortgage Industry.