SlideShare une entreprise Scribd logo
1  sur  45
Salesforce REST API
Remote SOQL, SOSL, CRUD and other available actions
Introduction
About myself:
Bohdan Dovhan
Salesforce Development Team Lead
Salesforce Certified Force.com Developer
Salesforce Certified Force.com Advanced Developer
7 years of Development experience
Representational state transfer
Representational state transfer is the software architectural style of the World Wide
Web. The purpose of REST architecture is to induce
* Performance Продуктивність?
* Scalability Масштабованість?
* Simplicity Простота?
* Modifiability Змінюваність?
* Visibility Видимість?
* Portability Переносність?
* Reliability Надійність
Roy Fielding coined the term
The term representational state transfer was introduced
and defined in 2000 by Roy Fielding in his doctoral
dissertation at UC Irvine. REST has been applied to
describe desired web architecture, to identify existing
problems, to compare alternative solutions and to
ensure that protocol extensions would not violate the
core constraints that make the web successful. Fielding
used REST to design HTTP 1.1 and Uniform Resource
Identifiers (URI).
RESTful systems
To the extent that systems conform to the constraints of REST they can be
called RESTful. RESTful systems typically, but not always, communicate over
Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST,
PUT, DELETE, PATCH ) that web browsers use to retrieve web pages and to
send data to remote servers. REST systems interface with external systems as
web resources identified by Uniform Resource Identifiers (URIs), for example
/people/tom, which can be operated upon using standard verbs such as GET
/people/tom.
Examples
* Google Glass API
* Twitter API
* Amazon Web Services
* Atom (RESTful alternative to RSS)
* Tesla Model S uses RESTful calls to communicate between mobile devices and car:
http://docs.timdorr.apiary.io/
Understanding Force.com REST Resources
A REST resource is an abstraction of a piece of information, such as a single data
record, a collection of records, or even dynamic real-time information. Each resource in
the Force.com REST API is identified by a named URI, and is accessed using standard
HTTP methods (HEAD, GET, POST, PATCH, DELETE). The Force.com REST API is
based on the usage of resources, their URIs, and the links between them.
NOTA BENE: no “PUT” verb. PUT was used to replace the entire resource, not used in
Force.com REST API
Understanding Force.com REST Resources
You use a resource to interact with your Salesforce or Force.com organization. For
example, you can:
Retrieve summary information about the API versions available to you.
Obtain detailed information about a Salesforce object such as an Account or a custom
object.
Obtain detailed information about Force.com objects, such as User or a custom object.
Perform a query or search.
Update or delete records.
What is the difference between HEAD and
GET?
The HTTP methods are used to indicate the desired action, such as retrieving
information, as well as creating, updating, and deleting records.
• HEAD is used to retrieve resource metadata. The same as GET but lacks resp. body
• GET is used to retrieve information, such as basic resource summary information.
• POST is used to create a new object.
• PATCH is used to update a record.
• DELETE is used to delete a record.
REST Principles: Stateless and Caching
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. However, the
representations of the resources are interconnected using URLs, which allow the client
to progress between states.
Caching behavior
Responses are labeled as cacheable or non-cacheable.
REST Principles: Uniformity and Naming
Uniform interface
All resources are accessed with a generic interface over HTTP.
Named resources
All resources are named using a base URI that follows your Force.com URI.
REST Principles: Layers and Authentication
Layered components
The Force.com REST API architecture allows for the existence of such intermediaries as
proxy servers and gateways to exist between the client and the resources.
Authentication
The Force.com REST API supports OAuth 2.0 (an open protocol to allow secure API
authorization).
JSON vs. XML
Support for JSON and XML
JSON is the default. You can use the HTTP ACCEPT header to select either JSON or
XML, or append .json or .xml to the URI (for example, /Account/001D000000INjVe.json).
The JavaScript Object Notation (JSON) format is supported with UTF-8. Date-time
information is in ISO8601 format.
XML serialization is similar to SOAP API. XML requests are supported in UTF-8 and
UTF-16, and XML responses are provided in UTF-8.
Relationship URLs a.k.a. “Friendly”
Why make two API calls when you can make just one? A friendly URL provides an
intuitive way to construct REST API requests and minimizes the number of round-trips
between your app and Salesforce org. Friendly URLs are available in API version 36.0
and later. This functionality is exposed via the SObject Relationships resource.
Accessing a contact’s parent account without a friendly URL involves requesting the
contact record using the SObject Rows resource. Then you examine the account
relationship field to obtain the account ID and request the account record with another
call to SObject Rows. Using a friendly URL, you can access the account in a single call
directly from the contact’s path: /services/data/v36.0/sobjects/contact/id/account.
REST API vs. SOAP API vs. Bulk API
SOAP API may be more convenient to process multiple records ( it has the same
method for one or multiple records DML operation while REST API has different
resource for multiple records DML operation /composite/tree/ )
If you need to process huge amount of data, use Bulk API
While it is possible to query or search for multiple records in REST API using one
request, to perform UpdateDelete operations you need to perform one request per each
record or use /composite/batch/ to unite DML operations in a batch
How can we know available versions?
Versions resource. URI: /
Formats: JSON, XML; HTTP Method: GET; Authentication: none; Parameters: none
Lists summary information about each Salesforce version currently available, including
the version, label, and a link to each version's root.
http://login.salesforce.com/services/data/
http://login.salesforce.com/services/data/v37.0 Is Summer’16 is on your production?
List Available REST Resources
Get a List of Objects
Get Field and Other Metadata for an Object
Get Field and Other Metadata for an Object
Running SOQL query
select Id, Name from Organization
select Id, Name from ApexClass
Running SOSL search
FIND {REST API DEMO} RETURNING ApexClass (Id, Name), ApexPage (Id, Name)
find {oil} returning account(id,name),
opportunity(id,name)
find {oil} returning account(id,name), opportunity(id,name)
Read record from another Organization
CRUD: Create using JSON Data
CRUD: Create using convenient interface
CRUD: Read
CRUD: Read using convenient interface
Certain objects do not allow DML in Apex
Organization o = [ select Id, Name from Organization ];
o.Name += 'x';
update o;
yields: Line: 3, Column: 1 DML not allowed on Organization
However, some of them allow REST API Update operations
CRUD: Update using JSON Data
CRUD: Update using convenient interface
CRUD: Delete
CRUD: Delete using convenient interface
CRUD: Error Handling
Access to custom REST Services
rel=/services/apexrest/AccoutEnhanced?name=oil
Access to custom REST Services
References
1. http://en.wikipedia.org/wiki/REST
2. http://docs.timdorr.apiary.io/#
3. http://www.slideshare.net/alexeiskachykhin/representational-state-transfer-36518469
4. http://www.slideshare.net/AshishGore3/dt-meetup-django-rest-framework-vs-tasty-pie
5. https://habrahabr.ru/post/38730/
6. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/
Q & A? Questions?
AND FINALLY:
MAY BE THE FORCE.COM WITH YOU...

Contenu connexe

Tendances

Lwc presentation
Lwc presentationLwc presentation
Lwc presentationNithesh N
 
Two-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsTwo-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsSalesforce Developers
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patternsusolutions
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platformJohn Stevenson
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web ComponentMohith Shrivastava
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelSalesforce Developers
 
Salesforce data model
Salesforce data modelSalesforce data model
Salesforce data modelJean Brenda
 
OpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for BeginnersOpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for BeginnersSalesforce Developers
 
Secure Salesforce: External App Integrations
Secure Salesforce: External App IntegrationsSecure Salesforce: External App Integrations
Secure Salesforce: External App IntegrationsSalesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
 
Salesforce complete overview
Salesforce complete overviewSalesforce complete overview
Salesforce complete overviewNitesh Mishra ☁
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforceMark Adcock
 
Salesforce intro session_for_students_v2
Salesforce intro session_for_students_v2Salesforce intro session_for_students_v2
Salesforce intro session_for_students_v2Stephen Edache Paul
 
Salesforce Tutorial for Beginners: Basic Salesforce Introduction
Salesforce Tutorial for Beginners: Basic Salesforce IntroductionSalesforce Tutorial for Beginners: Basic Salesforce Introduction
Salesforce Tutorial for Beginners: Basic Salesforce IntroductionHabilelabs
 
Dynamic input tables lwc vs aura vs. visualforce
Dynamic input tables  lwc vs aura vs. visualforceDynamic input tables  lwc vs aura vs. visualforce
Dynamic input tables lwc vs aura vs. visualforceMike Tetlow
 
Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation missmeryl
 

Tendances (20)

Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
 
Two-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsTwo-Way Integration with Writable External Objects
Two-Way Integration with Writable External Objects
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patterns
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platform
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
 
Salesforce data model
Salesforce data modelSalesforce data model
Salesforce data model
 
OpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for BeginnersOpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for Beginners
 
Secure Salesforce: External App Integrations
Secure Salesforce: External App IntegrationsSecure Salesforce: External App Integrations
Secure Salesforce: External App Integrations
 
Salesforce PPT.pptx
Salesforce PPT.pptxSalesforce PPT.pptx
Salesforce PPT.pptx
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Salesforce complete overview
Salesforce complete overviewSalesforce complete overview
Salesforce complete overview
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Salesforce intro session_for_students_v2
Salesforce intro session_for_students_v2Salesforce intro session_for_students_v2
Salesforce intro session_for_students_v2
 
Salesforce Tutorial for Beginners: Basic Salesforce Introduction
Salesforce Tutorial for Beginners: Basic Salesforce IntroductionSalesforce Tutorial for Beginners: Basic Salesforce Introduction
Salesforce Tutorial for Beginners: Basic Salesforce Introduction
 
Rest API
Rest APIRest API
Rest API
 
Dynamic input tables lwc vs aura vs. visualforce
Dynamic input tables  lwc vs aura vs. visualforceDynamic input tables  lwc vs aura vs. visualforce
Dynamic input tables lwc vs aura vs. visualforce
 
Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation Salesforce Service cloud 3 presentation
Salesforce Service cloud 3 presentation
 
Relationships in Salesforce
Relationships in SalesforceRelationships in Salesforce
Relationships in Salesforce
 
Salesforce overview
Salesforce overviewSalesforce overview
Salesforce overview
 

Similaire à Salesforce REST API

Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)Pete Morano
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJerry Kurian
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-servicesrporwal
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About RESTJeremy Brown
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About RESTMike Wilcox
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restishGrig Gheorghiu
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended VersionJeremy Brown
 

Similaire à Salesforce REST API (20)

SFDC REST API
SFDC REST APISFDC REST API
SFDC REST API
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Unerstanding and Using RESTful APIs
Unerstanding and Using RESTful APIsUnerstanding and Using RESTful APIs
Unerstanding and Using RESTful APIs
 
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
 
ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 
API Testing Basics.pptx
API Testing Basics.pptxAPI Testing Basics.pptx
API Testing Basics.pptx
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About REST
 
A Conversation About REST
A Conversation About RESTA Conversation About REST
A Conversation About REST
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
 
API Basics
API BasicsAPI Basics
API Basics
 
A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended Version
 
Rest
RestRest
Rest
 
Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
 

Plus de Bohdan Dovhań

PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023Bohdan Dovhań
 
Second-generation managed packages
Second-generation managed packagesSecond-generation managed packages
Second-generation managed packagesBohdan Dovhań
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Bohdan Dovhań
 
SFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateSFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateBohdan Dovhań
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeBohdan Dovhań
 
Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Bohdan Dovhań
 
Sdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesSdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesBohdan Dovhań
 
Being A Salesforce Jedi
Being A Salesforce JediBeing A Salesforce Jedi
Being A Salesforce JediBohdan Dovhań
 
Salesforce certifications process
Salesforce certifications processSalesforce certifications process
Salesforce certifications processBohdan Dovhań
 
Salesforce for marketing
Salesforce for marketingSalesforce for marketing
Salesforce for marketingBohdan Dovhań
 
Introduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceIntroduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceBohdan Dovhań
 

Plus de Bohdan Dovhań (13)

PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023PUBLISHING YOUR PACKAGE TO APPEXCHANGEIN 2023
PUBLISHING YOUR PACKAGE TO APPEXCHANGE IN 2023
 
Second-generation managed packages
Second-generation managed packagesSecond-generation managed packages
Second-generation managed packages
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance
 
SFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateSFDX - Spring 2019 Update
SFDX - Spring 2019 Update
 
Custom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex CodeCustom Metadata Records Deployment From Apex Code
Custom Metadata Records Deployment From Apex Code
 
Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)
 
SFDX Presentation
SFDX PresentationSFDX Presentation
SFDX Presentation
 
Sdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniquesSdfc forbidden and advanced techniques
Sdfc forbidden and advanced techniques
 
Being A Salesforce Jedi
Being A Salesforce JediBeing A Salesforce Jedi
Being A Salesforce Jedi
 
Salesforce certifications process
Salesforce certifications processSalesforce certifications process
Salesforce certifications process
 
Salesforce for marketing
Salesforce for marketingSalesforce for marketing
Salesforce for marketing
 
Introduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforceIntroduction about development, programs, saas and salesforce
Introduction about development, programs, saas and salesforce
 
ExtJS Sencha Touch
ExtJS Sencha TouchExtJS Sencha Touch
ExtJS Sencha Touch
 

Dernier

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 

Dernier (20)

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 

Salesforce REST API

  • 1. Salesforce REST API Remote SOQL, SOSL, CRUD and other available actions
  • 2. Introduction About myself: Bohdan Dovhan Salesforce Development Team Lead Salesforce Certified Force.com Developer Salesforce Certified Force.com Advanced Developer 7 years of Development experience
  • 3. Representational state transfer Representational state transfer is the software architectural style of the World Wide Web. The purpose of REST architecture is to induce * Performance Продуктивність? * Scalability Масштабованість? * Simplicity Простота? * Modifiability Змінюваність? * Visibility Видимість? * Portability Переносність? * Reliability Надійність
  • 4. Roy Fielding coined the term The term representational state transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation at UC Irvine. REST has been applied to describe desired web architecture, to identify existing problems, to compare alternative solutions and to ensure that protocol extensions would not violate the core constraints that make the web successful. Fielding used REST to design HTTP 1.1 and Uniform Resource Identifiers (URI).
  • 5. RESTful systems To the extent that systems conform to the constraints of REST they can be called RESTful. RESTful systems typically, but not always, communicate over Hypertext Transfer Protocol (HTTP) with the same HTTP verbs (GET, POST, PUT, DELETE, PATCH ) that web browsers use to retrieve web pages and to send data to remote servers. REST systems interface with external systems as web resources identified by Uniform Resource Identifiers (URIs), for example /people/tom, which can be operated upon using standard verbs such as GET /people/tom.
  • 6. Examples * Google Glass API * Twitter API * Amazon Web Services * Atom (RESTful alternative to RSS) * Tesla Model S uses RESTful calls to communicate between mobile devices and car: http://docs.timdorr.apiary.io/
  • 7. Understanding Force.com REST Resources A REST resource is an abstraction of a piece of information, such as a single data record, a collection of records, or even dynamic real-time information. Each resource in the Force.com REST API is identified by a named URI, and is accessed using standard HTTP methods (HEAD, GET, POST, PATCH, DELETE). The Force.com REST API is based on the usage of resources, their URIs, and the links between them. NOTA BENE: no “PUT” verb. PUT was used to replace the entire resource, not used in Force.com REST API
  • 8. Understanding Force.com REST Resources You use a resource to interact with your Salesforce or Force.com organization. For example, you can: Retrieve summary information about the API versions available to you. Obtain detailed information about a Salesforce object such as an Account or a custom object. Obtain detailed information about Force.com objects, such as User or a custom object. Perform a query or search. Update or delete records.
  • 9. What is the difference between HEAD and GET? The HTTP methods are used to indicate the desired action, such as retrieving information, as well as creating, updating, and deleting records. • HEAD is used to retrieve resource metadata. The same as GET but lacks resp. body • GET is used to retrieve information, such as basic resource summary information. • POST is used to create a new object. • PATCH is used to update a record. • DELETE is used to delete a record.
  • 10. REST Principles: Stateless and Caching 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. However, the representations of the resources are interconnected using URLs, which allow the client to progress between states. Caching behavior Responses are labeled as cacheable or non-cacheable.
  • 11. REST Principles: Uniformity and Naming Uniform interface All resources are accessed with a generic interface over HTTP. Named resources All resources are named using a base URI that follows your Force.com URI.
  • 12. REST Principles: Layers and Authentication Layered components The Force.com REST API architecture allows for the existence of such intermediaries as proxy servers and gateways to exist between the client and the resources. Authentication The Force.com REST API supports OAuth 2.0 (an open protocol to allow secure API authorization).
  • 13. JSON vs. XML Support for JSON and XML JSON is the default. You can use the HTTP ACCEPT header to select either JSON or XML, or append .json or .xml to the URI (for example, /Account/001D000000INjVe.json). The JavaScript Object Notation (JSON) format is supported with UTF-8. Date-time information is in ISO8601 format. XML serialization is similar to SOAP API. XML requests are supported in UTF-8 and UTF-16, and XML responses are provided in UTF-8.
  • 14. Relationship URLs a.k.a. “Friendly” Why make two API calls when you can make just one? A friendly URL provides an intuitive way to construct REST API requests and minimizes the number of round-trips between your app and Salesforce org. Friendly URLs are available in API version 36.0 and later. This functionality is exposed via the SObject Relationships resource. Accessing a contact’s parent account without a friendly URL involves requesting the contact record using the SObject Rows resource. Then you examine the account relationship field to obtain the account ID and request the account record with another call to SObject Rows. Using a friendly URL, you can access the account in a single call directly from the contact’s path: /services/data/v36.0/sobjects/contact/id/account.
  • 15. REST API vs. SOAP API vs. Bulk API SOAP API may be more convenient to process multiple records ( it has the same method for one or multiple records DML operation while REST API has different resource for multiple records DML operation /composite/tree/ ) If you need to process huge amount of data, use Bulk API While it is possible to query or search for multiple records in REST API using one request, to perform UpdateDelete operations you need to perform one request per each record or use /composite/batch/ to unite DML operations in a batch
  • 16. How can we know available versions? Versions resource. URI: / Formats: JSON, XML; HTTP Method: GET; Authentication: none; Parameters: none Lists summary information about each Salesforce version currently available, including the version, label, and a link to each version's root. http://login.salesforce.com/services/data/ http://login.salesforce.com/services/data/v37.0 Is Summer’16 is on your production?
  • 17.
  • 18. List Available REST Resources
  • 19.
  • 20. Get a List of Objects
  • 21.
  • 22. Get Field and Other Metadata for an Object
  • 23. Get Field and Other Metadata for an Object
  • 24. Running SOQL query select Id, Name from Organization
  • 25. select Id, Name from ApexClass
  • 26. Running SOSL search FIND {REST API DEMO} RETURNING ApexClass (Id, Name), ApexPage (Id, Name)
  • 27. find {oil} returning account(id,name), opportunity(id,name) find {oil} returning account(id,name), opportunity(id,name)
  • 28. Read record from another Organization
  • 29. CRUD: Create using JSON Data
  • 30. CRUD: Create using convenient interface
  • 32. CRUD: Read using convenient interface
  • 33. Certain objects do not allow DML in Apex Organization o = [ select Id, Name from Organization ]; o.Name += 'x'; update o; yields: Line: 3, Column: 1 DML not allowed on Organization However, some of them allow REST API Update operations
  • 34. CRUD: Update using JSON Data
  • 35. CRUD: Update using convenient interface
  • 37. CRUD: Delete using convenient interface
  • 39. Access to custom REST Services rel=/services/apexrest/AccoutEnhanced?name=oil
  • 40. Access to custom REST Services
  • 41. References 1. http://en.wikipedia.org/wiki/REST 2. http://docs.timdorr.apiary.io/# 3. http://www.slideshare.net/alexeiskachykhin/representational-state-transfer-36518469 4. http://www.slideshare.net/AshishGore3/dt-meetup-django-rest-framework-vs-tasty-pie 5. https://habrahabr.ru/post/38730/ 6. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/
  • 42. Q & A? Questions?
  • 43.
  • 44.
  • 45. AND FINALLY: MAY BE THE FORCE.COM WITH YOU...