SlideShare a Scribd company logo
All Aboard the Boxcar!
Going Beyond the Basics of REST
Pat Patterson
Developer Evangelist Architect
ppatterson@salesforce.com
@metadaddy
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 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.
Safe Harbor
RESTful principles
When our REST API ran out of steam
The Boxcar
Composite resources – still REST?
Agenda
RESTful Principles
Fielding’s Masterpiece
Client-Server
• Separate UI from Data Storage
• Independent evolution of components
Stateless
• Each request is self-contained
• Visibility, reliability, scalability
Cache
• Responses labeled as cacheable, or not
• Efficiency, scalability, performance
From http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Fielding’s Six Constraints
Uniform Interface
• Decouple implementations from services
• Trade-off: degraded efficiency
Layered System
• Each component cannot see beyond
the next layer
Code-On-Demand (optional)
• Extend client functionality via applets (!)
or scripts
Fielding’s Six Constraints
Identification of resources
• Resource: “any information that can be named”
Manipulation of resources through representations
• Current or intended state of resource
Self-descriptive messages
• Metadata: e.g. media type, last modified time
Hypermedia as the engine of application state
• Resource navigation via links contained in the representation
From http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
Uniform Interface
Resources identified by URIs
• http://api.example.com/widgets/w000123
Representation by Internet media types
• JSON
HTTP with standard methods
• GET, PUT, POST, DELETE, PATCH
Hypertext links between resources
• No ‘magic knowledge’ driving interaction
REST in Practice - 2015
Force.com REST API Demo
Principles in Practice
Transactional semantics when creating hierarchies of objects?
• ‘Stateless’ REST constraint means that transaction context is tricky
Performance with high latency networks (mobile clients)
• Client framework has a message queue, wants to submit multiple
operations in a single network request
But… All Was Not Perfect in the REST API!
All Aboard the Boxcar! Going Beyond the Basics of REST
POST to /vXX.X/composite/tree/ObjectName
{
"records" :[{
"attributes" : {"type" : "Account", "referenceId" : "ref1"},
"name" : "SampleAccount",
"Contacts" : {
"records" : [{
"attributes" : {"type" : "Contact", "referenceId" : "ref2"},
"lastname" : "Smith",
"email" : smith@example.com
}, {
"attributes" : {"type" : "Contact", "referenceId" : "ref3"},
"lastname" : "Jones",
"email" : jones@example.com
}]
}
}]
}
Create whole hierarchies of related objects in a single request
Solution 1: Object Trees
{
"hasErrors" : false,
"results" : [{
"referenceId" : "ref1",
"id" : "001D000000K0fXOIAZ"
},{
"referenceId" : "ref2",
"id" : "001D000000K0fXPIAZ"
},{
"referenceId" : "ref3",
"id" : "003D000000QV9n2IAD"
}]
}
Object Tree Response
Object Tree Demo
Principles in Practice
✔ Client-Server
✔ Stateless
✔ Cache
? Uniform Interface
✔ Layered System
Is This RESTful?
✔ Identification of resources
✔ Manipulation of resources through representations
✔ Self-descriptive messages
✔ Hypermedia as the engine of application state
What About Uniform Interface?
POST to /vXX.X/composite/batch
{
"batchRequests" : [{
"method" : "PATCH",
"url" : "v34.0/sobjects/account/001D000000K0fXOIAZ",
"richInput" : {"Name" : "NewName"}
},{
"method" : "GET",
"url" : "v34.0/sobjects/account/001D000000K0fXOIAZ?fields=Name,LastModifiedDate"
}]
}
Coalesce independent requests
Solution 2: Batch Requests
{
"hasErrors" : false,
"results" : [{
"statusCode" : 204,
"result" : null
},{
"statusCode" : 200,
"result": {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v34.0/sobjects/Account/001D000000K0fXOIAZ"
},
"Name" : "NewName",
"LastModifiedDate" : "2015-01-27T20:51:14.000+0000",
"Id" : "001D000000K0fXOIAZ"
}
}]
}
Batch Response
Batch Demo
Principles in Practice
✔ Client-Server
✔ Stateless
✔ Cache
? Uniform Interface
✔ Layered System
Is This RESTful?
✔ Identification of resources
✔ Manipulation of resources through representations
✔ Self-descriptive messages
✔ Hypermedia as the engine of application state
Straight JSON via HTTP is just one pattern, not the law!
What About Uniform Interface?
Go read (or reread!) Fielding’s dissertation…
at the very least, read chapter 5!
Follow the REST orthodoxy…
until it makes more sense to blaze a new trail…
and, even then, check that you’re not driving over a cliff!
Conclusion
Thank you

More Related Content

PPTX
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
PPTX
OData for iOS developers
PPTX
Odata - Open Data Protocol
PPTX
OData: A Standard API for Data Access
PPTX
JAX-RS 2.0 and OData
PDF
Introduction to External Objects and the OData Connector
PPT
Building RESTful Applications with OData
PDF
A Look at OData
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData for iOS developers
Odata - Open Data Protocol
OData: A Standard API for Data Access
JAX-RS 2.0 and OData
Introduction to External Objects and the OData Connector
Building RESTful Applications with OData
A Look at OData

What's hot (20)

PDF
SAP ODATA Overview & Guidelines
PPTX
PPTX
Open Data Protocol (OData)
PDF
Apache Olingo - ApacheCon Denver 2014
PPTX
OData - The Universal REST API
PPTX
OData and SharePoint
PPTX
OData, External objects & Lightning Connect
PPTX
Node learnings implementation
PPTX
WebLogic Developer Webcast 1: JPA 2.0
PPTX
Introduction To REST
PPT
How to separate the f2 e and sde in web development for_taobao
PPTX
GoToMeeting Competitive / Market Analysis
PPTX
OData Introduction and Impact on API Design (Webcast)
PPTX
OData Services
PDF
REST - Representational State Transfer
PPTX
JSON and REST
PDF
REST - Representational state transfer
PPTX
IndyCodeCamp SDS May 16th 2009
PPTX
RESTful Architecture
SAP ODATA Overview & Guidelines
Open Data Protocol (OData)
Apache Olingo - ApacheCon Denver 2014
OData - The Universal REST API
OData and SharePoint
OData, External objects & Lightning Connect
Node learnings implementation
WebLogic Developer Webcast 1: JPA 2.0
Introduction To REST
How to separate the f2 e and sde in web development for_taobao
GoToMeeting Competitive / Market Analysis
OData Introduction and Impact on API Design (Webcast)
OData Services
REST - Representational State Transfer
JSON and REST
REST - Representational state transfer
IndyCodeCamp SDS May 16th 2009
RESTful Architecture
Ad

Viewers also liked (20)

PDF
POKEMON JUEGO DE ROL.
PDF
Animals of our place
PDF
Itinerari formatiu radiodiagnostic 2015 2016
PDF
Infowatch endpoint security
PPTX
Estructuras organizativas
PDF
CAF- Iniciativa Regional de Patentes Tecnológicas para el Desarrollo
PPS
Folleto exposicion cervantes encantado2
PDF
Las TIC como alternativa innovadora a las tradicionales tareas para casa
PDF
3 c 3d_leave_v5_0_ext
PDF
Havas Digital - Social Media Attribution
PDF
Funcionamiento de las redes neuronales simples
PDF
Digitalisierungsbarometer/ Studie von Antrieb Mittelstand
PPTX
Historia de la Música en Cali.
DOCX
Unidad educativa imantag
PPTX
Comercio electronico características de programas indeseables
PPTX
Ingest and Stream Processing - What will you choose?
PPTX
Ingest and Stream Processing - What will you choose?
PDF
Building Custom Big Data Integrations
PDF
Ch11 functional arts
PDF
Mapreduce in Python
POKEMON JUEGO DE ROL.
Animals of our place
Itinerari formatiu radiodiagnostic 2015 2016
Infowatch endpoint security
Estructuras organizativas
CAF- Iniciativa Regional de Patentes Tecnológicas para el Desarrollo
Folleto exposicion cervantes encantado2
Las TIC como alternativa innovadora a las tradicionales tareas para casa
3 c 3d_leave_v5_0_ext
Havas Digital - Social Media Attribution
Funcionamiento de las redes neuronales simples
Digitalisierungsbarometer/ Studie von Antrieb Mittelstand
Historia de la Música en Cali.
Unidad educativa imantag
Comercio electronico características de programas indeseables
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?
Building Custom Big Data Integrations
Ch11 functional arts
Mapreduce in Python
Ad

Similar to All Aboard the Boxcar! Going Beyond the Basics of REST (20)

PPTX
Exploring the Salesforce REST API
PDF
Designing Custom REST and SOAP Interfaces on Force.com
PDF
Building towards a Composite API Framework in Salesforce
PPT
Designing custom REST and SOAP interfaces on Force.com
PDF
Enterprise API New Features and Roadmap
PDF
Boxcars and Cabooses: When one more XHR is too much - Peter Chittum - Codemot...
PPT
Salesforce Integration
PPTX
SFDC REST API
PPT
Salesforce REST API
PPTX
New Powerful API Enhancements for Summer '15
PDF
Enterprise REST
PPTX
Replicating One Billion Records with Minimal API Usage
PPTX
Navi Mumbai Salesforce DUG meetup on integration
PPTX
Using Apex for REST Integration
PDF
Workbench: The API Swiss Army Knife
PDF
Salesforce API Series: Integrating Applications with Force.com Webinar
PDF
PPTX
Lies you have been told about REST
PPTX
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
PPTX
February 2020 Salesforce API Review
Exploring the Salesforce REST API
Designing Custom REST and SOAP Interfaces on Force.com
Building towards a Composite API Framework in Salesforce
Designing custom REST and SOAP interfaces on Force.com
Enterprise API New Features and Roadmap
Boxcars and Cabooses: When one more XHR is too much - Peter Chittum - Codemot...
Salesforce Integration
SFDC REST API
Salesforce REST API
New Powerful API Enhancements for Summer '15
Enterprise REST
Replicating One Billion Records with Minimal API Usage
Navi Mumbai Salesforce DUG meetup on integration
Using Apex for REST Integration
Workbench: The API Swiss Army Knife
Salesforce API Series: Integrating Applications with Force.com Webinar
Lies you have been told about REST
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
February 2020 Salesforce API Review

More from Pat Patterson (20)

PPTX
DevOps from the Provider Perspective
PPTX
How Imprivata Combines External Data Sources for Business Insights
PPTX
Data Integration with Apache Kafka: What, Why, How
PPTX
Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...
PPTX
Dealing with Drift: Building an Enterprise Data Lake
PPTX
Integrating with Einstein Analytics
PPTX
Efficient Schemas in Motion with Kafka and Schema Registry
PPTX
Dealing With Drift - Building an Enterprise Data Lake
PPTX
Building Data Pipelines with Spark and StreamSets
PPTX
Adaptive Data Cleansing with StreamSets and Cassandra
PPTX
Open Source Big Data Ingestion - Without the Heartburn!
PPTX
Provisioning IDaaS - Using SCIM to Enable Cloud Identity
PPTX
Enterprise IoT: Data in Context
PPTX
API-Driven Relationships: Building The Trans-Internet Express of the Future
PPTX
Using Salesforce to Manage Your Developer Community
PPTX
Identity in the Cloud
PPTX
OpenID Connect: An Overview
PPTX
How I Learned to Stop Worrying and Love Open Source Identity (Paris Edition)
PPT
Salesforce Integration with Twilio
PPTX
SAML Smackdown
DevOps from the Provider Perspective
How Imprivata Combines External Data Sources for Business Insights
Data Integration with Apache Kafka: What, Why, How
Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...
Dealing with Drift: Building an Enterprise Data Lake
Integrating with Einstein Analytics
Efficient Schemas in Motion with Kafka and Schema Registry
Dealing With Drift - Building an Enterprise Data Lake
Building Data Pipelines with Spark and StreamSets
Adaptive Data Cleansing with StreamSets and Cassandra
Open Source Big Data Ingestion - Without the Heartburn!
Provisioning IDaaS - Using SCIM to Enable Cloud Identity
Enterprise IoT: Data in Context
API-Driven Relationships: Building The Trans-Internet Express of the Future
Using Salesforce to Manage Your Developer Community
Identity in the Cloud
OpenID Connect: An Overview
How I Learned to Stop Worrying and Love Open Source Identity (Paris Edition)
Salesforce Integration with Twilio
SAML Smackdown

Recently uploaded (20)

PPTX
history of c programming in notes for students .pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Digital Strategies for Manufacturing Companies
PPTX
Transform Your Business with a Software ERP System
PDF
medical staffing services at VALiNTRY
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
ai tools demonstartion for schools and inter college
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
System and Network Administraation Chapter 3
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
history of c programming in notes for students .pptx
How Creative Agencies Leverage Project Management Software.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Online Work Permit System for Fast Permit Processing
Internet Downloader Manager (IDM) Crack 6.42 Build 41
CHAPTER 2 - PM Management and IT Context
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Softaken Excel to vCard Converter Software.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Operating system designcfffgfgggggggvggggggggg
Digital Strategies for Manufacturing Companies
Transform Your Business with a Software ERP System
medical staffing services at VALiNTRY
Odoo Companies in India – Driving Business Transformation.pdf
ISO 45001 Occupational Health and Safety Management System
ai tools demonstartion for schools and inter college
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
System and Network Administraation Chapter 3
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool

All Aboard the Boxcar! Going Beyond the Basics of REST

  • 1. All Aboard the Boxcar! Going Beyond the Basics of REST Pat Patterson Developer Evangelist Architect ppatterson@salesforce.com @metadaddy
  • 2. 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 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. Safe Harbor
  • 3. RESTful principles When our REST API ran out of steam The Boxcar Composite resources – still REST? Agenda
  • 5. Client-Server • Separate UI from Data Storage • Independent evolution of components Stateless • Each request is self-contained • Visibility, reliability, scalability Cache • Responses labeled as cacheable, or not • Efficiency, scalability, performance From http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Fielding’s Six Constraints
  • 6. Uniform Interface • Decouple implementations from services • Trade-off: degraded efficiency Layered System • Each component cannot see beyond the next layer Code-On-Demand (optional) • Extend client functionality via applets (!) or scripts Fielding’s Six Constraints
  • 7. Identification of resources • Resource: “any information that can be named” Manipulation of resources through representations • Current or intended state of resource Self-descriptive messages • Metadata: e.g. media type, last modified time Hypermedia as the engine of application state • Resource navigation via links contained in the representation From http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm Uniform Interface
  • 8. Resources identified by URIs • http://api.example.com/widgets/w000123 Representation by Internet media types • JSON HTTP with standard methods • GET, PUT, POST, DELETE, PATCH Hypertext links between resources • No ‘magic knowledge’ driving interaction REST in Practice - 2015
  • 9. Force.com REST API Demo Principles in Practice
  • 10. Transactional semantics when creating hierarchies of objects? • ‘Stateless’ REST constraint means that transaction context is tricky Performance with high latency networks (mobile clients) • Client framework has a message queue, wants to submit multiple operations in a single network request But… All Was Not Perfect in the REST API!
  • 12. POST to /vXX.X/composite/tree/ObjectName { "records" :[{ "attributes" : {"type" : "Account", "referenceId" : "ref1"}, "name" : "SampleAccount", "Contacts" : { "records" : [{ "attributes" : {"type" : "Contact", "referenceId" : "ref2"}, "lastname" : "Smith", "email" : smith@example.com }, { "attributes" : {"type" : "Contact", "referenceId" : "ref3"}, "lastname" : "Jones", "email" : jones@example.com }] } }] } Create whole hierarchies of related objects in a single request Solution 1: Object Trees
  • 13. { "hasErrors" : false, "results" : [{ "referenceId" : "ref1", "id" : "001D000000K0fXOIAZ" },{ "referenceId" : "ref2", "id" : "001D000000K0fXPIAZ" },{ "referenceId" : "ref3", "id" : "003D000000QV9n2IAD" }] } Object Tree Response
  • 15. ✔ Client-Server ✔ Stateless ✔ Cache ? Uniform Interface ✔ Layered System Is This RESTful?
  • 16. ✔ Identification of resources ✔ Manipulation of resources through representations ✔ Self-descriptive messages ✔ Hypermedia as the engine of application state What About Uniform Interface?
  • 17. POST to /vXX.X/composite/batch { "batchRequests" : [{ "method" : "PATCH", "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ", "richInput" : {"Name" : "NewName"} },{ "method" : "GET", "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ?fields=Name,LastModifiedDate" }] } Coalesce independent requests Solution 2: Batch Requests
  • 18. { "hasErrors" : false, "results" : [{ "statusCode" : 204, "result" : null },{ "statusCode" : 200, "result": { "attributes" : { "type" : "Account", "url" : "/services/data/v34.0/sobjects/Account/001D000000K0fXOIAZ" }, "Name" : "NewName", "LastModifiedDate" : "2015-01-27T20:51:14.000+0000", "Id" : "001D000000K0fXOIAZ" } }] } Batch Response
  • 20. ✔ Client-Server ✔ Stateless ✔ Cache ? Uniform Interface ✔ Layered System Is This RESTful?
  • 21. ✔ Identification of resources ✔ Manipulation of resources through representations ✔ Self-descriptive messages ✔ Hypermedia as the engine of application state Straight JSON via HTTP is just one pattern, not the law! What About Uniform Interface?
  • 22. Go read (or reread!) Fielding’s dissertation… at the very least, read chapter 5! Follow the REST orthodoxy… until it makes more sense to blaze a new trail… and, even then, check that you’re not driving over a cliff! Conclusion

Editor's Notes

  • #7: Applets were big in 2000, Ajax wasn’t described until 2005
  • #8: Resources can be collections of other resources Fielding talks about HTML, JPEG – JSON not until 2001
  • #10: Use workbench to show REST API – root, sobjects, query, get account, create account, create contact, delete contact Show how validation fail on a contact leaves us with an account we don’t want
  • #15: Create account, contacts in one hit. Show how validation fail on a contact will back out account creation.
  • #17: Remember - resources can be collections of other resources
  • #22: Feels a bit SOAPy, but it’s effectively an extension of HTTP – once client understands batch semantics, no special magic knowledge required.