strike like lightning
The Ultimate Guide to Salesforce APIs in 2021
strike like lightning

The Ultimate Guide to Salesforce APIs in 2021

7 min read

Table of Contents

The Salesforce market is one of the fastest-growing in the world of enterprise platform services. This is in part due to the rapid realisation that, with proper integration, Salesforce can help businesses reach a new level of organisation and automation. Integrations help businesses better understand and utilise their data, by connecting different sets of data together into a unified ecosystem that can be efficiently leveraged for analytics and communications purposes.

Integrating your Salesforce Org with additional apps and functionalities gives you access to services that will streamline the way that your unique business uses Salesforce. These third-party applications are not necessarily compatible with Salesforce initially, and an API is required to bridge that gap.

What is an API?

what is an API

An API, or Application Programming Interface, is an interface that connects different applications and allows them to work together. APIs are the thing that connects each request or query to the bank of data that holds the answer behind the scenes, so you will find that almost all automated systems use them. When a query is made, it is the API that delivers the request to the source of the data, collects the response, and then returns the relevant data to the user. It may be helpful to think of an API as the data vehicle that moves information around between the source of the data and the different access points and User Interfaces.

Types of Salesforce APIs

types of Salesforce APIs

SOAP and REST APIs:

Every Salesforce API is built on either a basic SOAP or REST API. Though SOAP and REST form the basic structure of each API, Salesforce has a range of more specific APIs designed to process particular requests. Bespoke APIs can also be built by us to provide unique functionalities. Before choosing your specific APIs, it’s valuable to understand the differences between these two main frameworks.

SOAP API

SOAP (or Simple Object Access Protocol) API is a standardised messaging protocol that forms the basis of most modern APIs. It was the original Salesforce API, even before Apex was adopted as the main programming language. Key functions include updating, creating, or deleting records, and returning search results from an external application. Once it has been set up, it requires very little maintenance. It is popular with large enterprises because of its ability to process large volumes of data, thanks to the fact it uses XML and HTTP in the form of WSDL (Web Service Description Language) to communicate requests.

There are two kinds of WSDLs: Enterprise Web Services WSDL and Partner Web Services WSDL.

  • Enterprise Web Services WSDL - for customers and ISVs building integrations specific to their Salesforce Org.
  • Partner Web Services WSDL - for development partners creating generic integrations for multiple Salesforce Orgs. This can be used to access data from any of the organisations it connects to.

REST API

REST (or Representational State Transfer) API is a lightweight, less intensive alternative to SOAP API. It is far easier to integrate and develop than SOAP, and can therefore be more dynamic and customisable. REST doesn’t require you to generate WSDL files to connect your external app with your Salesforce Org and can return results in the smaller, quicker JSON format rather than XML. Apex, used by Salesforce, finds it easier to process JSON than XML. For these reasons, REST is preferred by mobile applications.

Comparing SOAP vs. REST

  • SOAP is more highly structured than REST
  • SOAP suits larger volumes of data transfer, while REST is suited to smaller, quicker data requests, particularly in JavaScript
  • SOAP APIs are favoured by large enterprises and form the basis of many modern applications

Salesforce APIs and their Uses

Salesforce APIs and their use cases

Connect REST API

The Connect API uses REST as its basis because its main aim is to make specific information visible in mobile applications. Connect API can access content from your CMS, notifications, Chatter feeds, user information, and much more, and display it in feeds.

Example Uses:

  • Building a mobile app
  • Integrating a third-party web application, with the goal of notifying users about data events and changes
  • Displaying a feed on an intranet site
  • Automatically posting Chatter items to Twitter
  • Building games to interact with the feed to get notifications

Metadata API

The Metadata API is used for managing customisations and build tools in your Salesforce Org, rather than data held within the system. Most commonly, Metadata API is used to migrate any new changes from the testing Sandbox environment into the live production environment. Use this API to access development tools, the Apex code in out-of-the-box Salesforce, and Visualforce. It is the second-oldest API used by Salesforce and is SOAP-based.

Example Uses:

  • Creating custom fields on a page layout
  • Updating Visualforce pages
  • Modifying security protocols
  • Modifying existing customisations
  • Exporting customisations as XML files

User Interface API

This API allows you to build your own User Interfaces that enable users to work with any part of your Salesforce data or metadata. The data is continually synchronised with your Salesforce Org, and therefore kept up-to-date while users access it. The API itself handles security and layout, keeping the UI build simple.

Example Use:

  • Building a user interface to display and edit data in the required way

Apex SOAP API

Use this API to open up your root Salesforce Apex code and architecture to outside developers through SOAP. Use of this API means that some Apex classes and methods can be implemented as web services (in the form of API endpoints which can be called by external services and applications). This API is often used when the standard Salesforce SOAP API is not sufficient for particular integrations.

Example Use:

  • If you outsource your development to an external company, like Magicforce, this will be required

Apex REST API

This API functions similarly to the Apex SOAP API, but is used with REST APIs instead.

Example Use:

  • If you outsource your development to an external company, like Magicforce, this will be required

Bulk API

This API is designed to allow you to edit a large volume of records with one command, whether you are creating, updating, viewing, or deleting. As the API works asynchronously, so requests may be processed in parallel, it will not try to edit too much data at once and can run on the quicker REST API model.

Example Use:

  • Submitting bulk queries, the answer to which can be reviewed later

Streaming API

The Streaming API will produce a stream of near-real-time information that logs all data changes within your Salesforce Org.

Example Use: Useful instances of Streaming API include push notifications in real-time as changes occur, and can be divided into four main types:

  • PushTopic Event: Notifications based on predefined queries and fields
  • Change Data Capture Event: Notifications with all changed fields and more detailed information about the nature of the changes
  • Platform Event: Notifications detailing a specific type of event, such as orders, which can be presented in platform event channels
  • Generic Event: Notifications with no defined schema

Tooling API

Tooling API is used to integrate metadata with other systems. One of its key benefits is its ability to process complex metadata types, which speeds up operations. You can also use this API to build custom development tools for your force.com applications; for example, managing Apex classes and Visualforce pages.

Example Uses:

  • Adding features to existing Lightning Platform tools
  • Building tools that are specialised for a new integration or application

Analytics REST API

The Analytics API allows users to access useful analytics, including specific datasets, filters, and dashboards. It also provides a shortcut to querying analytics, creating new filters or lenses for analysing data, and manipulating replicated datasets.

Example Uses:

  • Send queries straight into your Analytics Platform
  • Collect and group the lenses set up in Analytics
  • Back-up and restore analysed data
  • Troubleshoot issues within the business by detecting anomalies

Choosing your Salesforce APIs

how to choose Salesforce API

The possibilities with bespoke integrations in your Salesforce Org are endless. Implementing the right ones for your specialised needs will ensure you get the most out of your Salesforce system and set you in good stead for upcoming releases.

Choosing the right integrations and APIs for your business will depend on a number of factors specific to your business needs, which should be considered carefully. Work out what purpose you need the APIs to fulfil by considering these questions:

Would you prefer to import a WSDL in order to keep data access relatively straightforward?

If so, consider a standard SOAP API

Do you need data to be visible anywhere outside your Salesforce system, via a feed or user interface?

If so, consider the Connect API

Do you want to build a Salesforce user interface for native mobile apps and custom web apps?

If so, consider the User Interface API

What scale of data are you dealing with?

If you want to perform mass operations with large data volumes, Bulk API is your API of choice

How quickly do Salesforce or business users need to be notified of changes?

If you need fast notifications, consider the Streaming API

How invested are you in responding to business analytics?

If analytics play a big part in how you run your business and make informed decisions, consider the Analytics REST API

Salesforce AppExchange 101

Once you have answered each of these questions, you’re ready to start integrating your chosen APIs and tailoring them to suit your specific needs.

Magicforce can set up any of the APIs mentioned above or build bespoke integrations to suit your business needs. Our aim is to ensure you maximise the potential of your Salesforce Org, so that your business is efficient, connected, and future-proof.