SlideShare a Scribd company logo
Exploring the
Salesforce REST
API
Jay Hurst
Director, Product Management
@extraidea
Forward-Looking Statements
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 product or service availability, 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, new products and services, 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 any litigation, risks associated with
completed and any 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 and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing
important disclosures 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 presentations, 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.
Many customers are facing a set of challenges around
building client applications against the Salesforce REST
API.
Raise your hand if you:
• Have used the REST API in Salesforce
• Have tried to build a client application using the REST API but have
faced issues with the number of round trips
• Have a need to design efficient APIs and want to reduce the number of
API round trips to the Salesforce server
Building Streamlined APIs
Bulk
REST
Metadata
SOAP
Tooling
Streaming
INTEGRATIONLAYER
Point & Click
Integration Tools
Page
Builder
DECLARATIVE DEVELOPMENT
GLOBAL ENTERPRISE CLOUD INFRASTRUCTURE
PLATFORM SERVICES
APP MANAGEMENT & DEPLOYMENT
Workflow
Engine
UI FrameworkSharing &
Permissions
Global
Search
Reports &
Dashboards
Files
& Content
Authentication CollaborationEvent Log
Framework
Translation
Workbench
App
Builder
Process
Builder
Schema
Builder
Multi-Tenant Network
& Firewall
Auto
Updates
Backup &
Geodiversity
Security Trust
IDECLI Agile
Accelerator
Store
Builder
Dev
Console
Sandbox
Metadata
Heroku DX node.js
PROGRAMMATIC DEVELOPMENT
Database Smart
Containers
Heroku
Add-ons
Heroku
Button
Ruby
Identity
Global
Data Centers
Data
Storage
Single code
base
Python Java APEXPHP
Offline
Salesforce1 Mobile
Container Geolocation
Push
NotificationsSDK Mobile Identity
MOBILE SERVICES
Community
Builder
Page
Builder
App Cloud Gives You Tools for Building Any App
Full spectrum of capabilities from enterprise control to elastic flexibility
REST API
• Best suited for browser or mobile applications which do not
need to access high amounts of records
• Access data over REST
• XML or JSON
• Synchronous
• Authenticate with OAuth 2.0 (connected app)
https://www.salesforce.com/us/developer/docs/api_rest/
Anatomy of a REST API Call
https://na44.salesforce.com/services/data/v37.0/sobjects/Account/0010000000ABc12
Instance of Saleforce
API Type
API Version
API Subtype
Entity
Record ID
Traditional REST API Diagram
What is a Composite API?
What is a Composite API?
• An API that is built by combining existing API functions
• A single request to an API can perform multiple functions
• Orchestration of the composite APIs allow developer
controlled business logic and functionality
• Responses from one API method can be directed as inputs into another method
• Multiple APIs can be used in a single call to improve performance
• Compositions are key for designing efficient API for use in
mobile development
Salesforce Composite Resources
Batching REST Resource
• Resource which accepts multiple REST calls to execute
• A single Batch REST request can execute up to 25 sub-requests
• Sub-requests contains the resource (URI) and the method to execute
• Each sub-request is an unrelated API call
• Sub-requests are executed serially, in order, and as the running user
• As each sub-request completes, the call is committed
• Has one optional parameter
• haltOnError - indicates if the batch should stop on any error that is encountered
• The response will be a JSON object of responses from the
sub requests
Batch REST API Diagram
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Task
/services/data/v37.0/sobjects/Task
/services/data/v37.0/composite/batch
Example Batch Request
{"batchRequests" : haltonerror:true, [
{"method" : "POST",
"url" : "v34.0/sobjects/account/",
"richInput" : {"Name" : "NewName", "Industry" : "Tech"}},
{"method" : "GET",
"url" : "v34.0/sobjects/account/describe/"},
{"method" : "GET",
"url" : "v34.0/query?q=select id, name, industry from
account order by createddate desc limit 10"
}]
}
Example Successful Batch Response
{"hasErrors" : false,
"results" : [{
"statusCode" : 201,
"result": {"id" : "001B0000003xiArIAI”, "success" : true, "errors" : [ ]}
},
{
"statusCode" : 200,
"result": {"actionOverrides" : [ ], "activateable" : false, ...,
"undeletable" : true, "updateable" : true}
},
{
"statusCode" : 200,
"result": {"totalSize" : 10, "done" : true,
"records" : [{
"attributes" : {"type" : "Account”, "url" : "/services/data/v34.0/
sobjects/Account/001B0000003xiArIAI”},
...
}]
}
}]
}
Example Unsuccessful Batch Response
{"hasErrors" : true,
"results" : [{
"result" : [{"message" : "Required fields are missing: [Name]”,"errorCode" :
"REQUIRED_FIELD_MISSING",
"fields" : [ "Name" ]}],
"statusCode" : 400
},{
"result”:[{"message”:"Cannot access this resource in a batch request”,
"errorCode”: "INVALID_BATCH_REQUEST”}],
"statusCode" : 400
},{
"result" : [{
"message" : "nselect ids, name, industry from accountn^nERROR at Row:
1:Column:8nNo such column 'ids' on entity 'Account'. If you are
attempting to use a custom field, be sure to append the
'__c' after the custom field name. Please reference your WSDL or
the describe call for the appropriate names.”, "errorCode" :
"INVALID_FIELD"}],
"statusCode" : 400
}]}
Batching REST API Demo
TreeSave REST Resource
• Creates SObject trees with the same top level object type
• A recursive data structure that contains a root record, its data, and its child
records represented as other sObject trees
• The REST resource manages all of the ID creations and mapping
• Create an Account, Contact, Opportunity, and Note in a single call
• The request can contain the following:
• Up to a total of 200 records across all trees
• Up to five records of different types
• SObject trees up to five levels deep
• You can create 200 top level records, by only providing the top level
TreeSave API Diagram
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Task
/services/data/v37.0/sobjects/Task
/services/data/v37.0/composite/tree/Account
Using the TreeSave REST Resource
• The dev provides the record relations via a reference ID
• ReferenceId is used to link related records and to return errors
• Only Insert is supported
• Triggers, processes, and workflow rules fire separately for each of the
object levels
• EX – All triggers fire for all the top level records, then all fire for the second level
records, then third, etc…
• All records are rolled back on any error
• Error will indicate which referenceId had the error so that the developer can take
the appropriate action
Example TreeSave Request
{"records" :[
{"attributes" : {"type" : "Account", "referenceId" : "ref1"},
"name" : "SampleAccount”, "phone" : "1234567890”, "website" :
"www.salesforce.com", "numberOfEmployees”: "100”, "type" : "Analyst”,
"industry" : "Banking",
"Contacts" : {
"records" : [
{"attributes" : {"type" : "Contact", "referenceId" : "ref2"},
"lastname" : "Smith”, "title" : "President”, "email" :
"sample@salesforce.com" },
{"attributes" : {"type" : "Contact", "referenceId" : "ref3"},
"lastname" : "Evans”, "title" : "Vice President”, "email" :
"sample@salesforce.com”}]
}},
{"attributes" : {"type" : "Account", "referenceId" : "ref4"},
"name”: "SampleAccount2”, "phone”: "1234567890”, "website" :
"www.salesforce2.com", "numberOfEmployees”: "100”, "type" : "Analyst”,
"industry" : "Banking”}]
}
Example Successful TreeSave Response
{
"hasErrors" : false,
"results" : [ {
"referenceId" : "ref1",
"id" : "001B0000003xiAwIAI"
}, {
"referenceId" : "ref4",
"id" : "001B0000003xiAxIAI"
}, {
"referenceId" : "ref2",
"id" : "003B0000003l3L5IAI"
}, {
"referenceId" : "ref3",
"id" : "003B0000003l3L6IAI"
} ]
}
Example Unsuccessful TreeSave Response
{
"hasErrors" : true,
"results" : [ {
"referenceId" : "ref4",
"errors" : [ {
"statusCode" : "REQUIRED_FIELD_MISSING",
"message" : "Required fields are missing: [Name]",
"fields" : [ "Name" ]
} ]
} ]
}
TreeSave REST API Demo
Current Composite APIs on Salesforce
• There are a number of existing Composite resources
• The Batching REST resource allows for the sending of multiple REST calls in a
single round trip
• The calls are unrelated, simply reduces round trips
• The TreeSave REST resource allows creation of multiple records in a single call
• Limited to insert and all-or-none saves
• Apex REST can be used to build custom logic
• Requires complete design by the developer
Building a Composite API on Salesforce
• A new API which will be a combination of Batch and
TreeSave
• Outputs from one API call can be Inputs into another using the developer
assigned referenceId
• Ex - @Account1.id can be used in a later query, as a reference field, or in an action
• Friendly URLs will assist in navigating the resource hierarchy
• Ability to crawl the resource tree easily
• Ex - /services/data/v36.0/sobjects/Account/001X00000000123/Contacts will give you a list
of all Contacts on a the designated Account
• This will allow multiple CRUD operations to collections
• This will allow a simple layer of orchestration to the REST API
Composite REST API Diagram
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Account
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Contact
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Case
/services/data/v37.0/sobjects/Task
/services/data/v37.0/sobjects/Task
/services/data/v37.0/query/?q=select id
from account limit 4
/services/data/v37.0/sobjects/Case/describ
e
/services/data/v37.0/tree/Account
Query
Describe
Composite API Request
{"compositeRequest" : [{
"type" : "rest", "method" : "POST",
"url" : "/v30.0/sobjects/Account",
"referenceId" : "Account1",
"richInput" : {"Name" : "Salesforce"}
},{
"type" : "rest", "method" : "PATCH",
"referenceId" : "Contact1",
"url" : "/v30.0/sobjects/Contact/0030000000AB3d",
"richInput" : {"accountId" : "@{Account1.Id}"}
},{
"type" : "rest", "method" : "GET",
"referenceId" : "ContactsOfAccount1",
"url" : "/v30.0/sobjects/Account/@{Account1.Id}/Contacts"
}]}
Example Successful Composite Response
[{
"id" : "001B000000E8mNSIAZ",
"success" : true,
"errors" : [ ]
},
null,
{
"totalSize" : 1,
"done" : true,
"records" : [ {
"attributes" : {
"type" : "Contact",
"url" : "/services/data/v37.0/sobjects/Contact/003B0000006dUZMIA2"
},
"Id" : "003B0000006dUZMIA2",
…
} ]
} ]
Composite API Demo
What did we Learn?
• What is the Salesforce REST API
• Existing Features that begin to support
composite actions
• Batching API
• TreeSave API
• Composite API
• Demos of existing resources
Q&A
thank y u

More Related Content

What's hot (20)

PDF
Getting Started With Apex REST Services
Salesforce Developers
 
PPT
Salesforce Integration
Joshua Hoskins
 
PDF
Introduction to the Salesforce Security Model
Salesforce Developers
 
PPTX
Integrating with salesforce
Mark Adcock
 
PPTX
REST API in Salesforce
Vivek Deepak
 
PPTX
Salesforce administrator training presentation slides
Salesforce Associates
 
PPTX
Salesforce 101
501Partners
 
PDF
Introduction to Salesforce | Salesforce Tutorial for Beginners | Salesforce T...
Edureka!
 
PPTX
OAuth with Salesforce - Demystified
Calvin Noronha
 
PDF
Introduction to Oracle Cloud
johnnhernandez
 
PPTX
Introducing the Salesforce platform
John Stevenson
 
PPTX
Salesforce PPT.pptx
ShaikAllabakshu5
 
PDF
Lwc presentation
Nithesh N
 
PPTX
Salesforce Streaming event - PushTopic and Generic Events
Dhanik Sahni
 
PPTX
What Is Salesforce CRM? | Salesforce CRM Tutorial For Beginners | Salesforce ...
Edureka!
 
PDF
Salesforce crm projects
Advanz Knowledge Systems P Ltd
 
PPTX
Rest API
Rohana K Amarakoon
 
PPTX
Introduction to Salesforce Platform - Basic
sanskriti agarwal
 
PDF
Understanding the Salesforce Architecture: How We Do the Magic We Do
Salesforce Developers
 
PDF
Introduction to MuleSoft
Salesforce Developers
 
Getting Started With Apex REST Services
Salesforce Developers
 
Salesforce Integration
Joshua Hoskins
 
Introduction to the Salesforce Security Model
Salesforce Developers
 
Integrating with salesforce
Mark Adcock
 
REST API in Salesforce
Vivek Deepak
 
Salesforce administrator training presentation slides
Salesforce Associates
 
Salesforce 101
501Partners
 
Introduction to Salesforce | Salesforce Tutorial for Beginners | Salesforce T...
Edureka!
 
OAuth with Salesforce - Demystified
Calvin Noronha
 
Introduction to Oracle Cloud
johnnhernandez
 
Introducing the Salesforce platform
John Stevenson
 
Salesforce PPT.pptx
ShaikAllabakshu5
 
Lwc presentation
Nithesh N
 
Salesforce Streaming event - PushTopic and Generic Events
Dhanik Sahni
 
What Is Salesforce CRM? | Salesforce CRM Tutorial For Beginners | Salesforce ...
Edureka!
 
Salesforce crm projects
Advanz Knowledge Systems P Ltd
 
Introduction to Salesforce Platform - Basic
sanskriti agarwal
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Salesforce Developers
 
Introduction to MuleSoft
Salesforce Developers
 

Viewers also liked (20)

PPTX
Using Apex for REST Integration
Salesforce Developers
 
PDF
SalesForce WebServices part 2
Mindfire Solutions
 
PDF
Secure Salesforce: External App Integrations
Salesforce Developers
 
PPT
Advanced Platform Series - OAuth and Social Authentication
Salesforce Developers
 
PPTX
Lighting up the Bay, Real-World App Cloud
Salesforce Developers
 
PPTX
Lightning Developer Experience, Eclipse IDE Evolved
Salesforce Developers
 
PPTX
Introduction to the Wave Platform API
Salesforce Developers
 
PPTX
Introduction to Apex for Developers
Salesforce Developers
 
PPTX
Process Automation on Lightning Platform Workshop
Salesforce Developers
 
PPTX
Mastering the Lightning Framework - Part 2
Salesforce Developers
 
PDF
SLDS and Lightning Components
Salesforce Developers
 
PPTX
Mastering the Lightning Framework - Part 1
Salesforce Developers
 
PPTX
Build, Manage, and Deploy Mobile Apps Faster with App Cloud Mobile
Salesforce Developers
 
PDF
Javascript Security and Lightning Locker Service
Salesforce Developers
 
PPTX
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
PPTX
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Salesforce Developers
 
PPTX
Snap-in Service to Web and Mobile Apps
Salesforce Developers
 
PPTX
Building apps faster with lightning and winter '17
Salesforce Developers
 
PPTX
Lightning Experience with Visualforce Best Practices
Salesforce Developers
 
PPTX
OAuth
Vijay Naik
 
Using Apex for REST Integration
Salesforce Developers
 
SalesForce WebServices part 2
Mindfire Solutions
 
Secure Salesforce: External App Integrations
Salesforce Developers
 
Advanced Platform Series - OAuth and Social Authentication
Salesforce Developers
 
Lighting up the Bay, Real-World App Cloud
Salesforce Developers
 
Lightning Developer Experience, Eclipse IDE Evolved
Salesforce Developers
 
Introduction to the Wave Platform API
Salesforce Developers
 
Introduction to Apex for Developers
Salesforce Developers
 
Process Automation on Lightning Platform Workshop
Salesforce Developers
 
Mastering the Lightning Framework - Part 2
Salesforce Developers
 
SLDS and Lightning Components
Salesforce Developers
 
Mastering the Lightning Framework - Part 1
Salesforce Developers
 
Build, Manage, and Deploy Mobile Apps Faster with App Cloud Mobile
Salesforce Developers
 
Javascript Security and Lightning Locker Service
Salesforce Developers
 
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Salesforce Developers
 
Snap-in Service to Web and Mobile Apps
Salesforce Developers
 
Building apps faster with lightning and winter '17
Salesforce Developers
 
Lightning Experience with Visualforce Best Practices
Salesforce Developers
 
OAuth
Vijay Naik
 
Ad

Similar to Exploring the Salesforce REST API (20)

PDF
Building towards a Composite API Framework in Salesforce
Salesforce Developers
 
PDF
Boxcars and Cabooses: When one more XHR is too much - Peter Chittum - Codemot...
Codemotion
 
PPTX
All Aboard the Boxcar! Going Beyond the Basics of REST
Pat Patterson
 
PDF
Enterprise API New Features and Roadmap
Salesforce Developers
 
PPTX
New Powerful API Enhancements for Summer '15
Salesforce Developers
 
PDF
Designing Custom REST and SOAP Interfaces on Force.com
Salesforce Developers
 
PPTX
February 2020 Salesforce API Review
Lydon Bergin
 
PPT
Designing custom REST and SOAP interfaces on Force.com
Steven Herod
 
PDF
Sharing APIs at Scale for a Great Developer Experience
Postman
 
PPTX
Replicating One Billion Records with Minimal API Usage
Salesforce Developers
 
PPTX
SFDC REST API
Bohdan Dovhań
 
POTX
Using the Google SOAP API
Salesforce Developers
 
PPTX
Navi Mumbai Salesforce DUG meetup on integration
Rakesh Gupta
 
PDF
Boxcars and Cabooses: When One More XHR Is Too Much
Peter Chittum
 
PDF
[MBF2] Webinar plate-forme Salesforce #1
BeMyApp
 
PDF
[MBF2] Webinar plate-forme Salesforce #1
BeMyApp
 
DOCX
Salesforce Integration
Er. Prashant Veer Singh
 
PPTX
The Power of Salesforce APIs World Tour Edition
Peter Chittum
 
PDF
How One Billion Salesforce records Can Be Replicated with Minimal API Usage
Baruch Oxman
 
PPTX
OData: A Standard API for Data Access
Pat Patterson
 
Building towards a Composite API Framework in Salesforce
Salesforce Developers
 
Boxcars and Cabooses: When one more XHR is too much - Peter Chittum - Codemot...
Codemotion
 
All Aboard the Boxcar! Going Beyond the Basics of REST
Pat Patterson
 
Enterprise API New Features and Roadmap
Salesforce Developers
 
New Powerful API Enhancements for Summer '15
Salesforce Developers
 
Designing Custom REST and SOAP Interfaces on Force.com
Salesforce Developers
 
February 2020 Salesforce API Review
Lydon Bergin
 
Designing custom REST and SOAP interfaces on Force.com
Steven Herod
 
Sharing APIs at Scale for a Great Developer Experience
Postman
 
Replicating One Billion Records with Minimal API Usage
Salesforce Developers
 
SFDC REST API
Bohdan Dovhań
 
Using the Google SOAP API
Salesforce Developers
 
Navi Mumbai Salesforce DUG meetup on integration
Rakesh Gupta
 
Boxcars and Cabooses: When One More XHR Is Too Much
Peter Chittum
 
[MBF2] Webinar plate-forme Salesforce #1
BeMyApp
 
[MBF2] Webinar plate-forme Salesforce #1
BeMyApp
 
Salesforce Integration
Er. Prashant Veer Singh
 
The Power of Salesforce APIs World Tour Edition
Peter Chittum
 
How One Billion Salesforce records Can Be Replicated with Minimal API Usage
Baruch Oxman
 
OData: A Standard API for Data Access
Pat Patterson
 
Ad

More from Salesforce Developers (20)

PDF
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
PDF
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
PDF
Local development with Open Source Base Components
Salesforce Developers
 
PPTX
TrailheaDX India : Developer Highlights
Salesforce Developers
 
PDF
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
PPTX
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
PPTX
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
PPTX
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
PPTX
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
PDF
Live coding with LWC
Salesforce Developers
 
PDF
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
PDF
LWC Episode 3- Component Communication and Aura Interoperability
Salesforce Developers
 
PDF
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
PDF
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
PDF
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
PDF
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
PDF
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
PDF
Modern Development with Salesforce DX
Salesforce Developers
 
PDF
Get Into Lightning Flow Development
Salesforce Developers
 
PDF
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
Local development with Open Source Base Components
Salesforce Developers
 
TrailheaDX India : Developer Highlights
Salesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
Live coding with LWC
Salesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
Salesforce Developers
 
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
Modern Development with Salesforce DX
Salesforce Developers
 
Get Into Lightning Flow Development
Salesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 

Recently uploaded (20)

PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Executive Business Intelligence Dashboards
vandeslie24
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Import Data Form Excel to Tally Services
Tally xperts
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 

Exploring the Salesforce REST API

  • 1. Exploring the Salesforce REST API Jay Hurst Director, Product Management @extraidea
  • 2. Forward-Looking Statements 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 product or service availability, 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, new products and services, 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 any litigation, risks associated with completed and any 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 and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures 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 presentations, 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.
  • 3. Many customers are facing a set of challenges around building client applications against the Salesforce REST API. Raise your hand if you: • Have used the REST API in Salesforce • Have tried to build a client application using the REST API but have faced issues with the number of round trips • Have a need to design efficient APIs and want to reduce the number of API round trips to the Salesforce server Building Streamlined APIs
  • 4. Bulk REST Metadata SOAP Tooling Streaming INTEGRATIONLAYER Point & Click Integration Tools Page Builder DECLARATIVE DEVELOPMENT GLOBAL ENTERPRISE CLOUD INFRASTRUCTURE PLATFORM SERVICES APP MANAGEMENT & DEPLOYMENT Workflow Engine UI FrameworkSharing & Permissions Global Search Reports & Dashboards Files & Content Authentication CollaborationEvent Log Framework Translation Workbench App Builder Process Builder Schema Builder Multi-Tenant Network & Firewall Auto Updates Backup & Geodiversity Security Trust IDECLI Agile Accelerator Store Builder Dev Console Sandbox Metadata Heroku DX node.js PROGRAMMATIC DEVELOPMENT Database Smart Containers Heroku Add-ons Heroku Button Ruby Identity Global Data Centers Data Storage Single code base Python Java APEXPHP Offline Salesforce1 Mobile Container Geolocation Push NotificationsSDK Mobile Identity MOBILE SERVICES Community Builder Page Builder App Cloud Gives You Tools for Building Any App Full spectrum of capabilities from enterprise control to elastic flexibility
  • 5. REST API • Best suited for browser or mobile applications which do not need to access high amounts of records • Access data over REST • XML or JSON • Synchronous • Authenticate with OAuth 2.0 (connected app) https://www.salesforce.com/us/developer/docs/api_rest/
  • 6. Anatomy of a REST API Call https://na44.salesforce.com/services/data/v37.0/sobjects/Account/0010000000ABc12 Instance of Saleforce API Type API Version API Subtype Entity Record ID
  • 8. What is a Composite API?
  • 9. What is a Composite API? • An API that is built by combining existing API functions • A single request to an API can perform multiple functions • Orchestration of the composite APIs allow developer controlled business logic and functionality • Responses from one API method can be directed as inputs into another method • Multiple APIs can be used in a single call to improve performance • Compositions are key for designing efficient API for use in mobile development
  • 11. Batching REST Resource • Resource which accepts multiple REST calls to execute • A single Batch REST request can execute up to 25 sub-requests • Sub-requests contains the resource (URI) and the method to execute • Each sub-request is an unrelated API call • Sub-requests are executed serially, in order, and as the running user • As each sub-request completes, the call is committed • Has one optional parameter • haltOnError - indicates if the batch should stop on any error that is encountered • The response will be a JSON object of responses from the sub requests
  • 12. Batch REST API Diagram /services/data/v37.0/sobjects/Account /services/data/v37.0/sobjects/Account /services/data/v37.0/sobjects/Contact /services/data/v37.0/sobjects/Contact /services/data/v37.0/sobjects/Contact /services/data/v37.0/sobjects/Case /services/data/v37.0/sobjects/Case /services/data/v37.0/sobjects/Task /services/data/v37.0/sobjects/Task /services/data/v37.0/composite/batch
  • 13. Example Batch Request {"batchRequests" : haltonerror:true, [ {"method" : "POST", "url" : "v34.0/sobjects/account/", "richInput" : {"Name" : "NewName", "Industry" : "Tech"}}, {"method" : "GET", "url" : "v34.0/sobjects/account/describe/"}, {"method" : "GET", "url" : "v34.0/query?q=select id, name, industry from account order by createddate desc limit 10" }] }
  • 14. Example Successful Batch Response {"hasErrors" : false, "results" : [{ "statusCode" : 201, "result": {"id" : "001B0000003xiArIAI”, "success" : true, "errors" : [ ]} }, { "statusCode" : 200, "result": {"actionOverrides" : [ ], "activateable" : false, ..., "undeletable" : true, "updateable" : true} }, { "statusCode" : 200, "result": {"totalSize" : 10, "done" : true, "records" : [{ "attributes" : {"type" : "Account”, "url" : "/services/data/v34.0/ sobjects/Account/001B0000003xiArIAI”}, ... }] } }] }
  • 15. Example Unsuccessful Batch Response {"hasErrors" : true, "results" : [{ "result" : [{"message" : "Required fields are missing: [Name]”,"errorCode" : "REQUIRED_FIELD_MISSING", "fields" : [ "Name" ]}], "statusCode" : 400 },{ "result”:[{"message”:"Cannot access this resource in a batch request”, "errorCode”: "INVALID_BATCH_REQUEST”}], "statusCode" : 400 },{ "result" : [{ "message" : "nselect ids, name, industry from accountn^nERROR at Row: 1:Column:8nNo such column 'ids' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.”, "errorCode" : "INVALID_FIELD"}], "statusCode" : 400 }]}
  • 17. TreeSave REST Resource • Creates SObject trees with the same top level object type • A recursive data structure that contains a root record, its data, and its child records represented as other sObject trees • The REST resource manages all of the ID creations and mapping • Create an Account, Contact, Opportunity, and Note in a single call • The request can contain the following: • Up to a total of 200 records across all trees • Up to five records of different types • SObject trees up to five levels deep • You can create 200 top level records, by only providing the top level
  • 19. Using the TreeSave REST Resource • The dev provides the record relations via a reference ID • ReferenceId is used to link related records and to return errors • Only Insert is supported • Triggers, processes, and workflow rules fire separately for each of the object levels • EX – All triggers fire for all the top level records, then all fire for the second level records, then third, etc… • All records are rolled back on any error • Error will indicate which referenceId had the error so that the developer can take the appropriate action
  • 20. Example TreeSave Request {"records" :[ {"attributes" : {"type" : "Account", "referenceId" : "ref1"}, "name" : "SampleAccount”, "phone" : "1234567890”, "website" : "www.salesforce.com", "numberOfEmployees”: "100”, "type" : "Analyst”, "industry" : "Banking", "Contacts" : { "records" : [ {"attributes" : {"type" : "Contact", "referenceId" : "ref2"}, "lastname" : "Smith”, "title" : "President”, "email" : "[email protected]" }, {"attributes" : {"type" : "Contact", "referenceId" : "ref3"}, "lastname" : "Evans”, "title" : "Vice President”, "email" : "[email protected]”}] }}, {"attributes" : {"type" : "Account", "referenceId" : "ref4"}, "name”: "SampleAccount2”, "phone”: "1234567890”, "website" : "www.salesforce2.com", "numberOfEmployees”: "100”, "type" : "Analyst”, "industry" : "Banking”}] }
  • 21. Example Successful TreeSave Response { "hasErrors" : false, "results" : [ { "referenceId" : "ref1", "id" : "001B0000003xiAwIAI" }, { "referenceId" : "ref4", "id" : "001B0000003xiAxIAI" }, { "referenceId" : "ref2", "id" : "003B0000003l3L5IAI" }, { "referenceId" : "ref3", "id" : "003B0000003l3L6IAI" } ] }
  • 22. Example Unsuccessful TreeSave Response { "hasErrors" : true, "results" : [ { "referenceId" : "ref4", "errors" : [ { "statusCode" : "REQUIRED_FIELD_MISSING", "message" : "Required fields are missing: [Name]", "fields" : [ "Name" ] } ] } ] }
  • 24. Current Composite APIs on Salesforce • There are a number of existing Composite resources • The Batching REST resource allows for the sending of multiple REST calls in a single round trip • The calls are unrelated, simply reduces round trips • The TreeSave REST resource allows creation of multiple records in a single call • Limited to insert and all-or-none saves • Apex REST can be used to build custom logic • Requires complete design by the developer
  • 25. Building a Composite API on Salesforce • A new API which will be a combination of Batch and TreeSave • Outputs from one API call can be Inputs into another using the developer assigned referenceId • Ex - @Account1.id can be used in a later query, as a reference field, or in an action • Friendly URLs will assist in navigating the resource hierarchy • Ability to crawl the resource tree easily • Ex - /services/data/v36.0/sobjects/Account/001X00000000123/Contacts will give you a list of all Contacts on a the designated Account • This will allow multiple CRUD operations to collections • This will allow a simple layer of orchestration to the REST API
  • 26. Composite REST API Diagram /services/data/v37.0/sobjects/Account /services/data/v37.0/sobjects/Account /services/data/v37.0/sobjects/Contact /services/data/v37.0/sobjects/Contact /services/data/v37.0/sobjects/Case /services/data/v37.0/sobjects/Case /services/data/v37.0/sobjects/Task /services/data/v37.0/sobjects/Task /services/data/v37.0/query/?q=select id from account limit 4 /services/data/v37.0/sobjects/Case/describ e /services/data/v37.0/tree/Account Query Describe
  • 27. Composite API Request {"compositeRequest" : [{ "type" : "rest", "method" : "POST", "url" : "/v30.0/sobjects/Account", "referenceId" : "Account1", "richInput" : {"Name" : "Salesforce"} },{ "type" : "rest", "method" : "PATCH", "referenceId" : "Contact1", "url" : "/v30.0/sobjects/Contact/0030000000AB3d", "richInput" : {"accountId" : "@{Account1.Id}"} },{ "type" : "rest", "method" : "GET", "referenceId" : "ContactsOfAccount1", "url" : "/v30.0/sobjects/Account/@{Account1.Id}/Contacts" }]}
  • 28. Example Successful Composite Response [{ "id" : "001B000000E8mNSIAZ", "success" : true, "errors" : [ ] }, null, { "totalSize" : 1, "done" : true, "records" : [ { "attributes" : { "type" : "Contact", "url" : "/services/data/v37.0/sobjects/Contact/003B0000006dUZMIA2" }, "Id" : "003B0000006dUZMIA2", … } ] } ]
  • 30. What did we Learn? • What is the Salesforce REST API • Existing Features that begin to support composite actions • Batching API • TreeSave API • Composite API • Demos of existing resources
  • 31. Q&A