img1

Learning Objectives

After completing this article, you’ll be able to:

Prologue

The Salesforce API landscape is a vast and encompassing ecosystem. That’s because Salesforce takes an API-first approach to building features on the Salesforce Platform. API first means building a robust API for a feature before focusing on designing its UI. There exist four main data api commonly used throughout Salesforce. Namely, they are REST API, SOAP API, Bulk API, and Streaming API. Their purpose is to let you manipulate your Salesforce data only. The aforementioned APIs apply broadly across the spectrum of core Salesforce data.

API Groups

REST API Summary

Representational State Transfer API is a simple and powerful web service based on RESTful principles. It exposes all sorts of Salesforce functionality via REST resources and HTTP methods. For example, you can create, read, update, and delete (CRUD) records, search or query your data, retrieve object metadata, and access information about limits in your org. REST API supports both XML and JSON.

Bulk API Summary

The Bulk API is a specialized REST based API built for querying and creating large volumes of data at once. Generally speaking, it has the ability to work with large data sets like 500,000 records as such it is asynchronous in nature.

Streaming API Summary

Streaming api is an event based asynchronous API built for notifications similar to that of pub/sub architecture. This model allows users to subscribe to channels that broadcast certain types of data changes, subsequently reducing the number of API requests by eliminating the need for polling.

Soap API Summary

SOAP API is a robust and powerful web service based on a Web Services Description Language (WSDL) file. This file describes the different ways in which client can establish communication and provide the data methods to be consumed by such clients. SOAP API supports XML only.

API Access and Authentication

All API calls, except for the SOAP API login() call, require authentication. You can either use one of the supported OAuth flows or authenticate with a session ID retrieved from the SOAP API login() call (easiest).

API Limits

Due to the fact that Salesforce is based on a multi tenant environment architecture, it thus, limits the number of API calls per org to ensure the system health of the instance your provided. There are two types of API limits, concurrent limits cap the number of long-running calls (20 seconds or longer) running at one time. And total limits cap the number of calls made within a 24-hour period. Concurrent limits vary by org type, for example, for a sandbox org, it is 25 long-running calls. Total limits vary by org edition, license type, and expansion packs that you purchase. For example, an Enterprise Edition org gets 1,000 calls per Salesforce license and 200 calls per Partner Community license. If you want to know more, check out Salesforce Developer Limits and Allocations Quick Reference.

Which API to use?

Rest API Usage

REST API provides a convenient, and simple REST-based web interface for interacting with Salesforce. Its advantages include ease of integration and development, and it’s an excellent choice of technology for use with mobile and web applications.

SOAP API Usage

REST API provides a convenient, and simple SOAP-based web interface for interacting with Salesforce. It is mainly used for legacy systems, You can use SOAP API to create, retrieve, update, or delete records. Its not advantageous to use SOAP based web services for mobile applications due to the fact that generating SOAP client code from WSDL’s can be quite complex, and in the mobile world, this complexity is magnified by the fact that many organizations must produce the same mobile application for several platforms (iOS, Android, etc.). Re-coding the complex SOAP interfaces several times can be time-consuming and error-prone.

Chatter REST API Usage

Based on REST architecture, use Chatter REST API to display Chatter feeds, users, groups, and followers in mobile applications. Chatter REST API also provides programmatic access to files, recommendations, topics, notifications.

User Interface API Usage

Based on REST architecture, use the User Interface API, to build UI for mobile applications and custom web applications based on Salesforce Lightning experience UI framework. When using this API, you are offered both data and metadata in a single response. You don’t have to worry about layouts, picklists, field-level security, or sharing.

Analytics REST API Usage

The Analytics REST API is REST based, it has the capability provide access to assets such as, datasets, lenses, and dashboards programmatically. You can create and retrieve Analytics applications, retrieve a list of dependencies for an application.

Bulk API Usage

Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. Submit batches of data using queryAll, insert, update and delete operations asynchronously.

Metadata API Usage

Based on SOAP principles, use Metadata API to retrieve, deploy, create, update, or delete customizations for your org. he most common use is to migrate changes from a sandbox or testing org to your production environment. Metadata API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself. For example Apache the Ant Migration Tool and Saleforce-DX CLI.

Streaming API Usage

The streaming API is an event based notification API, use it to receive near real time streams of data that are based on changes in records.

Tooling API Usage

Based on based SOAP and REST architecture principles, Use this API to integrate Salesforce metadata with other systems. Metadata types are exposed as sObjects, so you can access one component individually. This field-level access speeds up operations on complex metadata types. You can also build custom development tools for Force.com applications. For example, use Tooling API to manage and deploy working copies of Apex classes and triggers and Visualforce pages and components.

APEX API Usage

You use Apex REST API and Apex SOAP API when you want to expose your Apex classes and methods so that external applications can access custom built functionality. Both API’s support OAuth 2.0 and Session ID for authorization.

Epilogue

The primary focus for this article was to introduce the different Salesforce platform API’s, their data formats, usages, and communication protocol. Brief summaries were provided to better aid the overall comprehension. Part 2 will be aimed at fleshing each API in more detail. Thanks for stopping by 😃 and i hope you was able to learn something new or reinforce what you already knew. A través del aprendizaje continuo, ¡mejorará!