API

 

Overview

 

An API, Application Programming Interface, is a set of rules/protocols that allow different software applications to communicate with each other.

 

How Are APIs Used?

 

API’s acts as an intermediary, enabling developers to access specific features or data from another application without having to understand the internal workings of that application. In Salesforce you will primarily interact with: REST, Soap, Bulk, Streaming, Metadata and Tooling API’s.

 

REST

REST uses standard HTTP methods (GET, POST, PUT, DELETE) for CRUD operations.  Commonly used for accessing Salesforce data and integrating with other systems.

 

SOAP

SOAP uses XML for requests and responses.  Often used in backend integrations at an enterprise level, providing complex security and transaction abilities.

 

Bulk

Designed for loading and deleting large volumes of data asynchronously. It supports both CSV and JSON formats.  Useful for data migrations and bulk updates where system performance could be an issue.

 

Streaming

Allows for real-time notifications of changes in Salesforce data. It uses the Bayeux protocol and is built on the CometD framework.  Ideal for real-time updates, such as dashboards or monitoring tools.

 

Metadata

Used to manage customizations and configurations in Salesforce, including creating, updating, and deleting metadata components (like custom objects, fields, etc.).  Useful for deployment processes and managing configuration changes across different Salesforce environments.

 

Tooling

Provides the ability to manage and manipulate metadata in a Salesforce org. It’s often used for development and debugging purposes.  Useful for building custom development tools and integrating with IDEs.

 

 

API Best Practices

Implementing API’s with Salesforce is an extremely helpful tool, but it is also one that needs to be carefully implemented. Choosing the right API type is the first step to success.

When designing the integration, using OAuto 2.0 for access as well as the most strict security profile possible for the integration user is also key when thinking about authentication and access.

Knowing limits is helpful, understanding errors, pause and retry limits will ensure you don’t break the integration.   Optimize SOQL queries, streamlining calls like GET and FOR that could iterate over thousands of records in a single transaction.

Implementing error handling is also crucial to ensuring that one bad record or transaction doesn’t ruin an entire integration.

Always test thoroughly (security and configuration) to ensure you don’t inhibit functionality or expose too much data and create a security risk.

 

Related Terms