Menu Bar

Monday, 26 August 2013

Which API Should I Use?


Which API Should I Use?

Available in: Enterprise, Unlimited, Developer, and Database.com Editions

User Permissions Needed
To use the APIs“API Enabled”
Salesforce provides programmatic access to your organization’s information using simple, powerful, and secure application 
programming interfaces.
API NameWhat It’s ForWhen to Use ItProtocolData FormatCommunication
REST APIAccessing objects in your organization using REST.You want to leverage the REST architecture to integrate with your organization. No WSDL requirement.
Well-suited for browser-based applications, mobile apps, and highly-interactive social applications.
RESTJSON, XMLSynchronous
SOAP APIIntegrating your organization’s data with other applications using SOAP.You have pre-existing middleware services that need to work with WSDLs and XML data.SOAP/WSDLXMLSynchronous
Chatter APIAccessing Chatter feeds and social data such as users, groups, followers, and files using REST.You want to integrate Chatter into a variety of applications, such as mobile apps, intranet sites, and third-party Web applications.RESTJSON, XMLSynchronous (photos are processed asynchronously)
Bulk APILoading or deleting large numbers of records.You have over a million records to process and speed is a requirement.RESTCSV, XMLAsynchronous
Metadata APIManaging customizations in your organization and building tools that can manage the metadata model, not the data itself.You want to migrate changes, such as custom object definitions and page layouts, from asandbox to your production environment.SOAP/WSDLXMLAsynchronous
Streaming APIProviding a stream of data reflecting data changes in your organization.You need near real-time notifications of when records are created or updated.BayeuxJSONAsynchronous (stream of data)
Apex REST APIBuilding your own REST API in Apex. ExposesApex classes as RESTful Web services.You need to build custom JSON responses or you want to expose custom functionality that you implemented in Apex.RESTJSON, XML, CustomSynchronous
Apex SOAP APICreating custom SOAP Web services in Apex. Exposes Apex classes as SOAP Web services.You need to build custom XML responses or you want to expose custom functionality that you implemented in Apex .SOAP/WSDLXMLSynchronous

When to Use REST API

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. However, if you have a large number of records to process, you may wish to use Bulk API, which is based on
 REST principles and optimized for large sets of data.

When to Use SOAP API

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. 
UseSOAP API in any language that supports Web services.
For example, you can use SOAP API to integrate Salesforce with your organization’s ERP and finance systems, deliver real-time sales
 and support information to company portals, and populate critical business systems with customer information.

When to Use Chatter API

Chatter API is a REST API that provides programmatic access to Chatter feeds and social data such as users, groups, followers, and files.
 It's used by developers who want to integrate Chatter into a variety of applications such as mobile applications, intranet sites,
 and third-party Web applications. Chatter API is similar to APIs offered by other companies with feeds, such as Facebook and Twitter. 
Its advantages include ease of integration and development.
Note
Chatter API and Chatter REST API refer to the same API.

When to Use Bulk API

Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, insert,
 update, upsert, or delete a large number of records asynchronously by submitting batches which are processed in the background
 by Salesforce.
SOAP API, in contrast, is optimized for real-time client applications that update small numbers of records at a time. Although SOAP API
  can also be used for processing large numbers of records, when the data sets contain hundreds of thousands of records, it becomes 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. 
This avoids the need to write your own client application.

When to Use Metadata API

Use Metadata API to retrieve, deploy, create, update, or delete customizations for your organization. 
The most common use is to migrate changes from a sandbox or testing organization 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 Force.com Migration Tool
These tools are built on top of Metadata API and use the standard Eclipse and Ant tools respectively to simplify the task of working 
with Metadata API. Built on the Eclipse platform, the Force.com IDE provides a comfortable environment for programmers familiar
 with integrated development environments, allowing you to code, compile, test, and deploy all from within the IDE itself. 
The Force.com Migration Tool is ideal if you want to use a script or a command-line utility for moving metadata between a local directory
 and a Salesforceorganization.

When to Use Streaming API

Use Streaming API to receive notifications for changes to data that match a SOQL query that you define.
Streaming API is useful when you want notifications to be pushed from the server to the client.
 Consider Streaming API for applications that poll frequently. Applications that have constant polling action against the Salesforce 
 infrastructure, consuming unnecessary API call and processing time, would benefit from this API which reduces the number of requests 
that return no data.Streaming API is also ideal for applications that require general notification of data changes. 
This enables you to reduce the number of API calls and improve performance.

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 your 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.

No comments: