introduction to the web services api
DESCRIPTION
When developing and deploying applications in the cloud, you often need to integrate with other applications and services. This session provides an overview and demonstration of the major forms of integration: Web services (setting one up and calling an existing service), HTTP-based interactions, Atom syndication feeds, and email.TRANSCRIPT
Introduction Web Services APIDeveloper
Alex ToussaintPlatform API : [email protected]@alextoussaint
Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year ended January 31, 2010. This documents and others are available on the SEC Filings section of the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Agenda
Platform APIs: Brief History– SOAP
– Bulk
– REST
– Also: Callouts & APEX WS
Integration Use Cases:– Enterprise Event Driven
– Large Data Volumes
– Mobile Devices, Apps
– Calling External Services
Web Services APIs
SOAP API– Most popular API in use today
– SOAP Based Services
– Synchronous
Bulk API– Ideal for very large data sets
– REST based services
– Asynchronous
REST API (Pilot)– Brand new API, current in Pilot
– REST based services
– Over 2900 Orgs enabled
APEX WS & Call Outs
Apex Web Services– APEX class exposed as Web Services
– Annotating the class as “webService”
– Can be invoked by external applications
– Define custom Web Services
Force.com Callouts– Leverage web services from anywhere
– Consume and interact with external services
– Inject and integrate with external systems
Scenarios & Recommendations
Enterprise Event Driven – Scenario 1
Thousands to millions of updates daily
Salesforce may or may not be the master
Changes in the system of record triggers an update
Additional logic maybe required during processing– Apex Logic, Triggers, Callout post processing
System of record could be:– Custom home grown, SAP, Oracle, other
Batching of records up to 200 at a time
Enterprise Event Driven - Recommendation
Consider using the SOAP API for integration path
Could be done via Middleware or Partner solution– Weblogic, WebSphere, Tibco, Informatica, IBM (Cast Iron)
Option to load up to 200 records per API call
Most popular integration path into Salesforce
Process millions of operations every month
For loads up to 5 million records consider DataLoader– Java based client for Windows 7 and XP
Force.com provides
programmatic access to
your organization’s
information using a
simple, powerful, and
secure Web Service
SOAP API
The Force.com Web Services APIOverview
1. Login– Log in to the login server
and receive authentication
information to be used for
subsequent calls
1
Username/Password
URL/Session ID TokenInternethttp/s
The Force.com Web Services APIHow does it work?
1. Populate Salesforce objects
(sObjects)– are representations of your
organization’s data
– e.g. accounts are represented
by an Account object
– The Account object has fields
that represent the account
name, phone number, shipping
address, and so on
2
The Force.com Web Services APIHow does it work?
1. Choose operation– Manipulate data: create, merge,
update, upsert, delete
– Replicate data locally: getDeleted,
getUpdated
– Perform administrative tasks:
getUserInfo, setPassword, etc.
– Obtain and navigate metadata:
describeSObject, etc.
– Work with workflow and approvals:
process
3
The Force.com Web Services APIHow does it work?
Similar to SQL syntaxSample SOQL statement:
SELECT Name FROM Account WHERE Name like 'A%’
Supports Relationships
Supports Aggregates
Support Anti/Semi-Joins
The Force.com Web Services API Salesforce Object Query Language (SOQL)
Large Data Volumes – Scenario 2
Need to manage hundreds of millions of records– 10M, 100M, 500M, 1B records
Loading speed is critical during the process
Short window of time for processing updates
Changes could be batched together
Asynchronous behavior is ok for the process
Large Data Volumes - Recommendation
Consider using the Bulk API for integration path
Could be done via Custom code or Partner Solution– Informatica, IBM (Cast Iron), DataLoader, Custom
Option to load up to 10,000 records per Batch
Default of 1000 batches per day, but wait– Contact Salesforce if you have a higher needs
– We can help load 100M, 500M, 1B records
On average 3-5x faster than SOAP API
Bulk APIAsynchronous API for loading of large data sets
ClientClientProcessing
ThreadProcessing
Thread
Processing Thread
Processing Thread
Processing Servers
Processing Servers
JobJob
Data batchData batch
Data batchData batch
Data batchData batch
ResultsResults
ResultsResults
ResultsResults
Dequeue batch from
job
Dequeue batch from
job
Insert or update records
Insert or update records
Save results to job
Save results to job
Send all data to server in large
batches
Send all data to server in large
batches
Check StatusCheck Status
Retrieve ResultsRetrieve Results
Choose operation– Manipulate data: insert, update,
upsert, delete
– Default 1000 batches per 24hrs
– Load up to 10,000 records per batch
– Load in Serial or Parallel mode
Bulk API How does it work?
Mobile Device, Web 2.0 – Scenario 3
Build applications for Mobile Devices– iPhone, Android, BlackBerry, Windows 7
– iPad, Tablets,
Web Based applications– Front end applications using Salesforce as Database
Web 2.0 type projects– Highly collaborative
Mobile Device, Web 2.0 - Recommendation
If you need to go into Production in the near term, your
best option is still the SOAP API
Our most used API processing millions of request on a
daily basis
If you are in the early prototype stages of your project
and leveraging Pilot code is Ok, may consider looking
at the REST API
REST API is still in Pilot
REST API (Pilot)Characteristics
Leverage HTTP
– Each resource in the Force.com REST API is a named URI that
is used with an HTTP method such as: HEAD, GET, POST,
PATCH, or DELETE.
Stateless
– Each request from client to server must contain all the
information necessary to understand the request, and not use
any stored context on the server
Uniform interface & Names Resources
– All resources are accessed with a generic interface over HTTP
– All resources are named using a base URI that follows
Salesforce.com URI
Authentication
– the Force.com REST API supports OAuth 2.0
– and our standard ways to get SID
Support XML and JSON
– You can use the HTTP ACCEPT header to select either JSON
or XML to be returned, or append .json or .xml to the URI, for
example (/Account/001D000000INjVe.json)
JSON & XML Format
– The JavaScript Object Notation ( JSON) format is supported
with UTF-8, with date-time information in ISO8601 format.
– XML requests are supported in UTF-8 and UTF-16
– and XML responses are provided in UTF-8
REST API (Pilot)Characteristics
Choose operation– Leverage HTTP to work with the
data GET, POST, PATCH, DELETE,
HEAD
– XML or JSON
– Leverage SOQL for queries
– Authentication – get SID from
session or OAuth2 services
– No WSDL
REST API (Pilot)How does it work?
REST API (Pilot)Resources
1. REST API Home– http://developer.force.com/REST
2. Register for Developer Account– http://developer.force.com/
3. Get REST API enabled in your Org– https://www.developerforce.com/events/rest_developer_preview/registration.php
4. Get a copy of our REST API documentation– http://boards.developerforce.com/t5/REST-API-Integration/bd-p/integration
5. Get involved in the REST Discussion Groups– http://boards.developerforce.com/t5/REST-API-Integration/bd-p/integration
Interact with External Services – Scenario 4
Data changes inside Salesforce, requires notifications
Records have to be updated in external systems
Processing requires external data to be fetched
Must kick off a data process externally
Call External Services - Recommendation
Consider using Outbound Messages– Asynchronous
– SOAP message sent to end point
Consider using Callouts– Synchronous & Asynchronous
– Call external services from APEX
Outbound Messaging– enables real-time integration
by sending Outbound SOAP
Messages from Force.com to
any Web Service endpoint
exposed on the Internet
based on triggered Workflow
Rules.
– is asynchronous
– allows easy callbacks into the
Force.com Platform using the
Force.com API (includes
url/sessionid token)
Internet
Outbound Messaging
Account
Contact
Opportunity
NativeSalesforce Object
Web Service
Endpoint
SOAP
Call back using Partner/Enterprise URL,
Session ID Token contained in the original Outbound
Message
Outbound Messaging Overview
Outbound Messaging is– Reliable
• 24 hours retry for failed
Outbound Messages
• Dead Letter Queue
– Secure• Supports HTTP/S
• Supports X.509 Client
Certificates
• Outbound Messages sent
from salesforce.com IP
Addresses
• Outbound Messages contain
Salesforce.com
OrganizationId
Outbound MessagingCharacteristics
Internet
Outbound Messaging
Account
Contact
Opportunity
NativeSalesforce Object
Web Service
Endpoint
SOAP
Force.com Callouts is a powerful capability of
the Apex programming language.
With Force.com Callouts, developers can
leverage Web services from anywhere, and
build them into their cloud applications.
Apex Web Service
Client
OracleWeb
Service
FacebookWeb
Service
AmazonWeb
Service
GoogleWeb
Service
Force.com CalloutsOverview
Force.com Callouts– allows synchronous and asynchronous
callout to any public Web Service from
within Apex Code
– creates Apex Code stubs based on a Web
Service’s WSDL file (think of it like
WSDL2Apex)
Force.com CalloutsOverview
Apex Web Service
Client
OracleWeb
Service
FacebookWeb
Service
AmazonWeb
Service
GoogleWeb
Service
Force.com provides several services for developers to build integrations and applications in the cloud
Platform API Services– SOAP
– Bulk
– REST (Pilot)
Calling External Services– Callouts
– Outbound Messages
Key Take Aways
D I S C O V E R
Visit the Developer Training and Support Booth in Force.com Zone
Discover
Developer
Learning Paths
Developer training, certification and support resources
S U C C E S SFind us in the Partner Demo Area of
Force.com Zone 2nd Floor Moscone West
that help you achieve
Learn about Developer
Certifications
Remember. . .
Check Chatter for additional session information
Get your developer Workbooks and Cheat Sheets in
the Force.com Zone
Visit for more information related
to this topicDon’t forget the survey!
How Could Dreamforce Be Better? Tell Us!
Log in to the Dreamforce app to submit
surveys for the sessions you attendedUse the
Dreamforce Mobile app to submit
surveysEvery session survey you submit is
a chance to win an iPod nano!
OR
Introduction Web Services API