REST API Developer Preview Dave Carroll Developer Evangelist dcarroll@salesforce.com @dcarroll Alex Toussaint Sr. Product Manager atoussaint@salesforce.com @alextoussaint
Safe Harbor Safe 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, 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-Q for the most recent fiscal quarter ended April 30, 2010. This document 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 Shift in Cloud Computing Force.com API Family REST API What is REST? Characteristics Anatomy of REST call Start Exploring Demos Rest Explorer Android Client HTML5/Ipad Next Steps
Fundamental Shift in Cloud Computing Low Cost. Fast. Easy-to-use Collaboration. Real-time. Mobile
The Force.com API 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 for Winter 11 Release) Brand new API suitable for Web 2.0 projects, mobile devices, HTML5 REST based services Synchronous Pilot launch with over 1000 developers
What is REST? The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation: http://www.ics.uci.edu/~taylor/documents/2002-rest-toit.pdf Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web Simplify how developers can build applications and services to work over the web Can you translate that to English for me? What is a resource?
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 Caching Behavior Responses are labeled as cacheable or non-cacheable Uniform interface All resources are accessed with a generic interface over HTTP Named resources All resources are named using a base URI that follows Salesforce.com URI
Characteristics 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 Format The JavaScript Object Notation ( JSON) format is supported with UTF-8, with date-time information in ISO8601 format. XML serialization is similar to the SOAP-based Web services API XML Format XML requests are supported in UTF-8 and UTF-16 and XML responses are provided in UTF-8
Anatomy of REST API call HTTP Method + Resource + Authorization curl http://na1.salesforce.com/services/data/v20.0/sobjects/account/ -H "Authorization: OAuth token" -H "X-PrettyPrint:1 curl http://na1.salesforce.com/services/data/v20.0/sobjects/attachment/ 001D000000INjVe/body -H "Authorization: OAuth token" -H "X-PrettyPrint:1 curl http://na1.salesforce.com/services/data/v20.0/query/?q=select+name +from+account-h "Authorization: OAuth token" -H "X-PrettyPrint:1 An HTTP ACCEPT header used to indicate the resource format (XML or JSON), or a.json or.xml extension Any JSON or XML files for requests, such as updating a record with new information
Authenticating with OAuth2 Looking to correct/improve issues with 1.0 Based on OAuth WRAP Actively being defined in IETF WG Salesforce, Google, Microsoft, Facebook, Twitter, Yahoo, and lots of others Initial implementations from MSFT, Google, Twitter, Facebook, 37 signals, Github.and Salesforce Very simple programming model Defined flows for a wide set of clients Several example libraries available
Configuring a Client Setup/Administration/Create/Remote Access
When to use REST? Applications running on a Browser or Mobile device Simpler syntax, small foot print Leverage HTTP standards Front end, client based integrations Web 2.0 type projects Commonly associated with web applications that facilitate interactive information sharing, interoperability, user-centered design, and collaboration User interacting with system, getting data chunks at a time Enterprise projects where WSDL contract not required The detailed data typing provided WSDL is not required JSON formatted results HTTP are your method calls
Basic Calls - Start Exploring Get a list of resources: http://na1.salesforce.com/services/data/v20.0/ Get a List of Available Objects http://na1.salesforce.com/services/data/v20.0/sobjects/ Get Basic Object Information http://na1.salesforce.com/services/data/v20.0/sobjects/account/ Get a List of Fields http://na1.salesforce.com/services/data/v20.0/sobjects/account/describe/ Executing a SOQL Query http://na1.salesforce.com/services/data/v20.0/query?q=select+name+from +Account
Demo - REST Explorer Available at the App Store today /services/data/v20.0/query?q=select+name+from+account /services/data/v20.0/sobjects/account/describe/
Demo - Android
Demo - ipad/html5 App
REST API - Pilot Typical questions we get at this point: What happens with the SOAP API? What happens with the Bulk API? Authenticate using SID or OAuth2 REST Upsert? Cross domain scripting? Considering etags? More Documentation? More samples? InterOp testing? Patch Why? Serialization/Deserialization of JSON in APEX? Where do we go from here? Can we deploy our app to production?
Questions
Next Steps 1. Register for Developer Account http://developer.force.com/ 2. Get REST API enabled in your Org https://www.developerforce.com/events/rest_developer_preview/registration.php 3. Get a copy of our REST API documentation http://boards.developerforce.com/t5/rest-development/bd-p/rest 4. Get involved in the REST Discussion Groups http://boards.developerforce.com/t5/rest-development/bd-p/rest 5. Come meet us at CloudStock 2010 http://www.cloudstockevent.com/?d=70130000000fwti 6. Come meet us at Dream Force 2010 http://www.salesforce.com/dreamforce/df10/home/ 7. Survey http://bit.ly/restapi6am
Thank you!