Which API Do I Use?
Salesforce provides programmatic access to
your org’s information using simple, powerful, and secure application
programming interfaces.
REQUIRED
EDITIONS AND USER PERMISSIONS
|
|
USER
PERMISSIONS NEEDED
|
||||
To use the APIs:
|
API Enabled
|
|||
API
NAME
|
PROTOCOL
|
DATA
FORMAT
|
COMMUNICATION
|
|
REST API
|
REST
|
JSON, XML
|
Synchronous
|
|
SOAP API
|
SOAP (WSDL)
|
XML
|
Synchronous
|
|
Chatter REST API
|
REST
|
JSON, XML
|
Synchronous (photos
are processed asynchronously)
|
|
User Interface API
|
REST
|
JSON
|
Synchronous
|
|
Analytics REST API
|
REST
|
JSON, XML
|
Synchronous
|
|
Bulk API
|
REST
|
CSV, JSON, XML
|
Asynchronous
|
|
Metadata API
|
SOAP (WSDL)
|
XML
|
Asynchronous
|
|
Streaming API
|
Bayeux
|
JSON
|
Asynchronous (stream
of data)
|
|
Apex REST API
|
REST
|
JSON, XML, Custom
|
Synchronous
|
|
Apex SOAP API
|
SOAP (WSDL)
|
XML
|
Synchronous
|
|
Tooling API
|
REST or SOAP (WSDL)
|
JSON, XML, Custom
|
||
REST API provides a powerful, convenient, and
simple REST-based web services 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 applications and web projects. For
certain projects, you may want to use REST API with other Salesforce REST APIs.
To build UI for creating, reading, updating, and deleting records, including
building UI for list views, actions, and dependent picklists, use User
Interface API. To build UI for Chatter, communities, or recommendations, use
Chatter REST API. If you have many records to
process, consider using Bulk API, which is based on REST principles and
optimized for large sets of data.
SOAP API provides a powerful, convenient, and
simple SOAP-based web services interface for interacting with Salesforce. You
can use SOAP API to create, retrieve, update, or delete records. You can also
use SOAP API to perform searches and much more. Use SOAP API in any language
that supports web services.
For example, you can use SOAP API to integrate Salesforce with
your org’s ERP and finance systems. You can also deliver real-time sales and
support information to company portals and populate critical business systems
with customer information.
When to Use Chatter REST API
Use Chatter REST API to display Chatter feeds, users, groups,
and followers, especially in mobile applications. Chatter REST API also
provides programmatic access to files, recommendations, topics, notifications,
Data.com purchasing, and more. Chatter REST API is similar to APIs offered by
other companies with feeds, such as Facebook and Twitter, but it also exposes
Salesforce features beyond Chatter.
When to Use User Interface API
Build Salesforce UI for native mobile apps and custom web apps
using the same API that Salesforce uses to build Lightning Experience and
Salesforce for Android, iOS, and mobile web. Build user interfaces that let
users work with records, list views, actions, favorites, and more. Not only do
you get data and metadata in a single response, but the response matches
metadata changes made to the org by Salesforce admins. You don’t have to worry
about layouts, picklists, field-level security, or sharing—all you have to do
is build an app that users love.
You can access Analytics assets—such as datasets, lenses, and
dashboards—programmatically using the Analytics REST API. Send queries directly
to the Analytics Platform. Access datasets that have been imported into the
Analytics Platform. Create and retrieve lenses. Access XMD information.
Retrieve a list of dataset versions. Create and retrieve Analytics
applications. Create, update, and retrieve Analytics dashboards. Retrieve a
list of dependencies for an application. Determine what features are available
to the user. Work with snapshots. Manipulate replicated datasets.
Bulk API is based on REST principles and is optimized for loading
or deleting large sets of data. You can use it to query, queryAll,
insert, update, upsert, or delete many records asynchronously by submitting
batches. Salesforce processes batches in the background.
SOAP API, in contrast, is optimized for
real-time client applications that update a few records at a time. You can use
SOAP API for processing many records, but when the data sets contain hundreds
of thousands of records, SOAP API is less practical. Bulk API is designed to make it
simple to process data from a few thousand to millions of records.
The
easiest way to use Bulk API is to enable it for processing records in Data
Loader using CSV files. Using Data Loader avoids the need to write your own
client application.
Use Metadata API to retrieve, deploy, create,
update, or delete customizations for your org. The 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.
The easiest way to access the functionality in
Metadata API is to use the Force.com IDE or Ant Migration Tool. Both tools are
built on top of Metadata API and use the standard Eclipse and Ant tools,
respectively, to simplify working with Metadata API.
- Force.com
IDE is built on the Eclipse platform, for programmers familiar with
integrated development environments. Code, compile, test, and deploy from
within the IDE.
- The Ant Migration Tool is ideal
if you use a script or the command line for moving metadata between a
local directory and a Salesforce org.
Use Streaming API to receive near-real-time streams of data that
are based on changes in Salesforce records or custom payloads. For Salesforce
record changes, Salesforce publishes notifications when the changes occur. For
custom notifications, you can publish event messages. Subscribers can receive
notifications using CometD—an implementation of the Bayeux protocol that
simulates push technology. Clients can subscribe to some types of events with
Apex triggers or declaratively with Process Builder and flows.
Use the type of streaming event that suits your needs.
PushTopic
Event
Receive changes to Salesforce records based on
a SOQL query that you define. The notifications include only the fields that
you specify in the SOQL query.
Change
Data Capture Event
Receive changes to Salesforce records with all
changed fields. Change Data Capture supports more standard objects than
PushTopic events and provides more features, such as header fields that contain
information about the change. Change Data Capture is part of a pilot program.
To participate in the pilot, contact Salesforce.
Platform
Event
Publish and receive custom payloads with a
predefined schema. The data can be anything you define, including business
data, such as order information. Specify the data to send by defining a
platform event. Subscribe to a platform event channel to receive notifications.
Generic
Event
Publish and receive arbitrary payloads without
a defined schema.
When to Use Apex REST API
Use Apex REST API when you want to expose your Apex classes and
methods so that external applications can access your code through REST
architecture. Apex REST API supports both OAuth 2.0 and Session ID for
authorization.
When to Use Apex SOAP API
Use Apex SOAP API when you want to expose Apex methods as SOAP
web service APIs so that external applications can access your code through
SOAP.
Apex SOAP API supports both OAuth 2.0 and Session ID for
authorization.
When to Use Tooling API
Use Tooling API to integrate Salesforce metadata with other
systems. Metadata types are exposed as sObjects, so you can access one
component of a complex type. 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. You can also set checkpoints or heap dump markers, execute
anonymous Apex, and access logging and code coverage information.
REST and SOAP are both supported.
No comments:
Post a Comment