Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (3 votes)
484 views

Step-By-Step DIY Guide: To Salesforce For

This document provides a step-by-step guide to using the Salesforce REST API for non-developers. It outlines creating a connected app in Salesforce, installing the Advanced REST Client Chrome extension, and making API calls to query, create, update, and delete records. Key steps include generating a security token, copying the consumer key and secret, and granting permission to the user's profile. The guide is intended for those with a Salesforce developer edition account and a basic understanding of REST concepts.

Uploaded by

mohemedsk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
484 views

Step-By-Step DIY Guide: To Salesforce For

This document provides a step-by-step guide to using the Salesforce REST API for non-developers. It outlines creating a connected app in Salesforce, installing the Advanced REST Client Chrome extension, and making API calls to query, create, update, and delete records. Key steps include generating a security token, copying the consumer key and secret, and granting permission to the user's profile. The guide is intended for those with a Salesforce developer edition account and a basic understanding of REST concepts.

Uploaded by

mohemedsk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Step-By-Step DIY Guide

To Salesforce REST API For


Non-Developers

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 1
Using This Guide
A couple of standards/conventions have been followed in this guide.
Here is what they mean
Important information. Take a closer look and follow as
Text with Red Background advised. You may not be able to complete the exercise
successfully if you miss these instructions

General explanation/information to support actions


Text with Yellow Background mentioned on the slide. Will assist you in understanding
what is being done and why

1. Text with White background, red Actions that you need to follow to configure. Carry out these
border and a number. In a callout
format
steps in the order of its sequence number.

Appears on the bottom bar of the page on left hand side.


Text with Green Background Provides information on the Hardware and Software
currently being used
Visit Visit
asagarwal.com for
asagarwal.com foruseful tipsand
useful tips andtricks
tricks on Salesforce
on Salesforce 2
Steps Overview
■ Create Connected Apps in Salesforce
■ Install Advanced REST Client in Google Chrome
■ Connect to Salesforce from Advanced REST Client
■ Query Records in Salesforce using REST API
■ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 3
Related Blog
If you haven’t already, please navigate to the following blog post URL
before starting with this guide. The post contains useful information
and links to relevant resources including the option to download the
PDF copy of the presentation

http://www.asagarwal.com/a-60-minutes-step-by-step-diy-guide-to-sales
force-rest-api-for-non-developers

Visit Visit
asagarwal.com for
asagarwal.com foruseful tipsand
useful tips andtricks
tricks on Salesforce
on Salesforce 4
Ingredients
■ Salesforce Developer Edition / Enterprise Edition or above. Your
Salesforce Edition must allow the API Access. Your can sign up for
a FREE Salesforce Developer Edition at URL
https://developer.salesforce.com/
■ Google Chrome
■ Internet connection
■ Vodka with ice, lemon & a pinch of salt celebrate your learning. :-)

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 5
Steps Overview
➡ Create Connected Apps in Salesforce
■ Install Advanced REST Client in Google Chrome
■ Connect to Salesforce from Advanced REST Client
■ Query Records in Salesforce using REST API
■ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 6
Login To Salesforce

1. Login to Salesforce Org

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 7
Get Your Security Token

1. Click on your name ->


My Settings

If you do not already have your security


token, follow these steps to get your
security token. If you already have the
security token, you can skip this section

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 8
Get Your Security Token

1. Click on Personal

2. Click ‘Reset My Security Token’. If you have


specified the ‘Login IP Ranges’ at the profile
level, then you will not see option. In that case
you don’t need the security token and you can
skip the rest of the steps in this section

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 9
Get Your Security Token

1. Click ‘Reset Security Token’. The


security token will be emailed to your
email address

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 10
Get Your Security Token

1. You will get the confirmation that the


security token has been emailed to your
email address

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 11
Get Your Security Token

1. Navigate to your inbox and copy and


paste the security token in a text editor

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 12
Create Connected Apps

1. Back in Salesforce,
Click on Setup

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 13
Create Connected Apps

1. Navigate to Create -> Apps

2. Click New
Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 14
Create Connected Apps

1. Specify the Connected App


Name, API Name and Contact
Email

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 15
Create Connected Apps
1. Check Enable OAuth Settings

2. Specify Callback URL. Just specify the value


https://localhost:8080. This will not be used

3. Select ‘Full Access (full) from Available OAuth


Scopes and move it to Selected OAuth Scopes

4. Click Save

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 16
Create Connected Apps

1. Click Continue

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 17
Create Connected Apps

2. Click on ‘Click to reveal’ for Consumer


Secret

1. Copy and paste the Consumer Key in a


text editor. We will need to use it later
Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 18
Create Connected Apps

2. Click on Manage

1. Copy and paste the Consumer Secret in


a text editor. We will need to use it later
together with Consumer Key

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 19
Grant Permission to User’s Profile

1. Click Edit

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 20
Grant Permission to User’s Profile

1. Under OAuth Policies for ‘Permitted


Users’ select the value ‘Admin
approved users are pre-authorized’

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 21
Grant Permission to User’s Profile

1. Click OK

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 22
Grant Permission to User’s Profile

1. Click Save

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 23
Grant Permission to User’s Profile

1. Scroll down the page

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 24
Grant Permission to User’s Profile

1. Click on Manage Profile

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 25
Grant Permission to User’s Profile

2. Click Save

1. Select the Profile of the user who


will be connecting through REST API
Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 26
Verify that the User’s Profile is API Enabled

1. Ensure that the profile of the user with which you want to
connect using REST API has the ‘API Enabled’ permission
checked. If you are connecting with the user whose profile is
‘System Administrator’, this is checked by default

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 27
Steps Overview
✓ Create Connected Apps in Salesforce
➡ Install Advanced REST Client in Google Chrome
■ Connect to Salesforce from Advanced REST Client
■ Query Records in Salesforce using REST API
■ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 28
Install Advanced REST Client
1. Open Google Chrome and click on
‘Customize and control Google Chrome’
icon

2. Select More Tools -> Extensions

Now let’s proceed to install the Advanced


REST Client in Google Chrome Browser

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 29
Install Advanced REST Client

1. Scroll down the page and click ‘Get


more extensions’

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 30
Install Advanced REST Client

1. Type ‘Advanced REST Client’ and


press Enter

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 31
Install Advanced REST Client

1. Click ‘Add to Chrome’ for Advanced


REST Client

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 32
Install Advanced REST Client

1. Click Add App

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 33
Install Advanced REST Client

1. Click on ‘Apps’ icon in Google


Chrome to view all Apps installed in
Google Chrome

2. Click on ‘Advanced REST


client’

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 34
Install Advanced REST Client

Now we are ready to explore the magic of Salesforce


REST API. The first thing we need to do is to
connect to Salesforce from Advanced REST Client

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 35
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
➡ Connect to Salesforce from Advanced REST Client
■ Query Records in Salesforce using REST API
■ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 36
Connecting to Salesforce from REST Client
To connect to Salesforce from Advanced REST API Client, you need to
prepare the connection string as per following format

https://login.salesforce.com/services/oauth2/token?grant_type=p
assword&client_id=<client_id>&client_secret=<client_secret>&use
rname=<username>&password=<password><security_token>

Replace the value highlighted in blue with your own values

1. Use login.salesforce.com if you are connecting to production or developer edition org. Use
test.salesforce.com if you want to connect to Sandbox.
2. Replace <client_id> with Consumer key copied in previous steps
3. Replace <client_secret> with Consumer Secret copied in previous steps
4. Replace <username> with your Salesforce Username
5. Replace <password> with your Salesforce password. Append the security token if applicable

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 37
Connecting to Salesforce from REST Client
So your final connection string should like something like this

https://login.salesforce.com/services/oauth2/token?grant_type=p
assword&client_id=3BRG9rKhT8ocoxGlaFYGe98k75x5bSs1_f2tFh.EM7Ppv
DCu.d_wubQWT0yPLUlit0599q.1Bz8Ud_2Ujkf9Z&client_secret=47234524
3512440999&username=ashish@asagarwal.com&password=ilovesalesfor
ceiAb1J1diHc8DSVle9dTZJ4Q0e

No, Don’t try to connect using the above string. These are not the
actual values of my Salesforce Org. :-)

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 38
Connecting to Salesforce from REST Client

1. In Advanced REST Client, paste the connection string


2. Select the method as here
POST

3. Click ‘Send’ and keep your


fingers crossed
ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 39
Connecting to Salesforce from REST Client
1. Scroll down the page and look the value in the status column. If If you don’t get the status 200 or see
the status is 200, bingo. You have successfully logged on to “authentication failure”, you will need to
Salesforce review the steps that you have completed
so far and ensure that all the instructions
were followed correctly. Also make sure
that your password does not contain ‘&’
(ampersand) character

2. Look at the values returned by Salesforce. Copy and


paste these values in a text editor. We will need to use
some of these values in subsequent calls

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 40
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
➡ Query Records in Salesforce using REST API
■ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 41
Execute Query through REST API
Now that you are connected, you can execute a SOQL Query in
Salesforce through REST API. The URI for the REST Query is

https://<instance_url>/services/data/v35.0/query?q=<SOQL Query>

Replace the value highlighted in blue with your own values

1. Use the value of instance_url returned in the response of the login call
2. v35.0 - This will be the API version. This changes with every new release of
Salesforce. For example for Winter 16 release of Salesforce, the API version is
35.0
3. SOQL Query that you want to execute

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 42
Execute Query through REST API
1. To execute a query in Salesorce using REST API, specify the URI, i.e.
https://<instance_url>/services/data/v35.0/query?q=<SOQL Query>
where you replace the value of the instance URL with the value returned as response from the login call

2. Select the
HTTP method
to GET

3. Set the Header of the REST API Call to “ Authorization: Bearer <access_token> “ 4. Click Send
where the value of the access token is the value returned in the response of the login
call

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 43
Execute Query through REST API

1. Alternatively, you can click on the ‘Form’ tab for HTTP Headers and specify the
Header and its value separately 2. Click Send

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 44
Execute Query through REST API

1. If everything goes well, you should see a


status of 200 returned by the API. This
means that your request was successful

2. And here is the response to your


query in JSON format. We can also
get the response in XML format but
hold on to that for now. We have
other more important things to learn

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 45
Review Steps
Now that you have executed a simple REST API call, let’s do a quick recap of
steps
■ Connect to Salesforce and get an Access Token
■ Make REST Calls specifying
■ The Resource URI (stands for Uniform Resource Identifier)
■ The HTTP Method (e.g. GET, POST, PATCH etc.)
■ The Request Headers (e.g. Access Token)
■ Review Response
■ The Status Code (200 denotes all OK)
■ The response Body (by default is returned in JSON format)
Once you have response returned by the API, you can process the response in
whatever way you want. E.g. if you are using Java to make API calls, use Java
libraries and methods to process the JSON response returned by the API

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 46
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
➡ Create Record in Salesforce using REST API
■ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 47
Creating Record through REST API
1. To create a record in Salesorce using REST API, specify the URI, i.e.
https://<instance_url>/services/data/v35.0/sobjects/<Object API Name>

Here I am creating an ‘Account’ Record

2. Select the
HTTP method to
POST

3. Set the Header of the REST API Call to


Authorization Bearer <access_token>
Content-Type application/json

4. Since we are creating a record here, we need to specify the values for the fields in Account
object in JSON format (this is known as PAYLOAD). In the PAYLOAD section, select ‘Raw’ tab 5. Click Send
and enter the values as shown here. The value is entered in format of

“Field API Name”: “Field Value”

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 48
Creating Record through REST API

1. And Voila, Salesforce REST API has


dutifully created the record in Account
object in Salesforce

2. In the response to the Create Call, Salesforce sends you


the Salesforce Record Id, a success flag and errors. If you
see any errors here, correct the error and retry

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 49
Creating Record through REST API

1. If you don’t believe me, logon to your Salesforce instance,


navigate to Account tab see it for yourself. The Account you
just created using Salesforce API very much exists there

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 50
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
✓ Create Record in Salesforce using REST API
➡ Update Record in Salesforce using REST API
■ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 51
Updating Record through REST API
1. Oops ! I made a mistake. I forgot to specify the Billing City & Phone for the Account I just created. Let’s correct it. To
update a record in Salesorce using REST API, specify the URI, i.e.
https://<instance_url>/services/data/v35.0/sobjects/<Object API Name>/<Salesforce Record Id>

2. Select the
HTTP method to
PATCH

3. Set the Header of the REST API Call to


Authorization Bearer <access_token>
Content-Type application/json

4. To update the record, follow the same method as Create. Specify the fields and their values
5. Click Send
in the Payload in JSON format. In the PAYLOAD section, select ‘Raw’ tab and enter the values
as shown here. The value is entered in format of

“Field API Name”: “Field Value”

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 52
Updating Record through REST API

1. And the status code that you will receive this time is 204.

2. However, there is no content in the response. This does not


mean that the record has not been updated. This just means that
Salesforce has no response to send if it updates the record
successfully.

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 53
Updating Record through REST API

1. You are still not believing me. Come on. Refresh your
Account tab in Salesforce and see it for yourself.

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 54
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
✓ Create Record in Salesforce using REST API
✓ Update Record in Salesforce using REST API
➡ Delete Record in Salesforce using REST API
■ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 55
Deleting Record through REST API
1. Ok, let’s complete the cycle. Now, we will delete the record we just created. To delete a record in Salesforce using
REST API, specify the URI, i.e.
https://<instance_url>/services/data/v35.0/sobjects/<Object API Name>/<Salesforce Record Id>

2. Select the HTTP


method to DELETE

3. Set the Header of the REST API Call to


Authorization Bearer <access_token>
The Content-Type is not required here

4. The Payload is also not required so just click on Send

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 56
Deleting Record through REST API

1. The status code that you will receive is again 204.

2. And there is no content in the response (unless there are any


errors). Salesforce has deleted the record successfully

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 57
Deleting Record through REST API

1. Switch back to Salesforce and go to Recycle Bin and the


record you just deleted has been moved to Recycle Bin

Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 58
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
✓ Create Record in Salesforce using REST API
✓ Update Record in Salesforce using REST API
✓ Delete Record in Salesforce using REST API
➡ Other REST API Calls
■ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 59
Other REST API Calls
1. To get a list of all the objects in your Salesforce instance use the URI
https://<instance_url>/services/data/v35.0/sobjects/

2. Set the HTTP


Method to GET
3. Set the Header of the REST API Call to
Authorization Bearer <access_token>
4. Click Send

Now that we have learnt how to query,


create, update & delete using REST API,
let’s explore some more API calls

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 60
Other REST API Calls

1. And in response you will get a list of all the SObjects and its details in
your Salesforce Instance.

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 61
Other REST API Calls
1. To get a list of all the child relationships and fields in an object use
the URI
https://<instance_url>/services/data/v35.0/sobjects/<Object
Name>/describe

2. Set the HTTP


Method to GET
3. Set the Header of the REST API Call to
Authorization Bearer <access_token>

4. Click Send

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 62
Other REST API Calls

1. And in response you will get a list of all the child


relationships, fields and its attributes on the specified
SObject

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 63
Other REST API Calls
1. To get a list of all the field values on a particular record use the URI
https://<instance_url>/services/data/v35.0/sobjects/<Object Name>/<Salesforce Record Id>

2. Set the HTTP


Method to GET
3. Set the Header of the REST API Call to
Authorization Bearer <access_token>
4. Click Send

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 64
Other REST API Calls

1. And in response you will get a list of all the fields and its
values for the specified record id.

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 65
Additional Reading
■ In previous slides, we have seen a few useful URIs and the
functionality that they provide.
■ There are many other URIs that Salesforce REST API provides.
Refer to Salesforce REST API Developer Guide at the following
URL to learn more about these URIs
■ https://resources.docs.salesforce.com/sfdc/pdf/api_rest.pdf

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 66
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
✓ Create Record in Salesforce using REST API
✓ Update Record in Salesforce using REST API
✓ Delete Record in Salesforce using REST API
✓ Other REST API Calls
➡ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 67
Extra Bytes
Hopefully these examples give you a pretty good idea on how to use
the Salesforce REST API. Now let’s take a look at
■ Some of the other things that REST API supports
■ Useful features of “Advanced REST Client” (ARC) Google Chrome
extension that we are using

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 68
Getting Response in XML Format

To get the response in XML format, all you need to do is to set the Request Header to
Accept application/xml

By default all responses to REST API


Calls are in JSON format. However you
do have the option of getting the
response in XML format also
ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 69
Getting Response in XML Format

Salesforce REST API will now


return the response in XML format

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 70
Sending Payload in XML Format

1. To send the payload in XML format, you need to specify the


request header to
Content-Type application/xml

2. And make sure that the Payload is in XML format as shown


Any Payload that you are sending to
here. The field API Names are appearing as XML tags in the
Salesforce should be in JSON format.
Payload
However you also have the option of
sending the payload in XML format
ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 71
Sending Payload in XML Format

1. Salesforce creates the record and returns the response in


XML format because in the REST Call on previous slide, we
also set the request header to
Accept application/xml

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 72
Useful Information - Supported HTTP Methods
Salesforce REST API supports the following HTTP Methods

■ HEAD (to retrieve resource metadata)


■ GET (to retrieve information)
■ POST (to create a record)
■ PATCH (to update a record)
■ DELETE (to delete a record)

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 73
Useful Information - Status Codes
■ To view a list of different status codes that Salesforce REST API
returns, please refer to the following URL
■ https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_re
st/errorcodes.htm

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 74
ARC Features - Save

1. You can save your REST API Call details for future
use. In ARC click on ‘Save’

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 75
ARC Features - Save

1. Specify a Name and click ‘Save’

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 76
ARC Features - Open

1. Once saved, you can reload the API call details by


clicking on Open

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 77
ARC Features - Open

1. Click on ‘Select’ for the desired call

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 78
ARC Features - History

2. Click Select to reload


1. In ARC, click on History to view a history of the API call in ARC
all the recent calls made to Salesforce

ARC in Chrome on Mac Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 79
Steps Overview
✓ Create Connected Apps in Salesforce
✓ Install Advanced REST Client in Google Chrome
✓ Connect to Salesforce from Advanced REST Client
✓ Query Records in Salesforce using REST API
✓ Create Record in Salesforce using REST API
✓ Update Record in Salesforce using REST API
✓ Delete Record in Salesforce using REST API
✓ Other REST API Calls
✓ Extra Bytes

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 80
Celebrate Your Learning
■ Though the examples in this guide is specific to Salesforce, you
can use Advanced REST Client (ARC) extension to test REST API
Calls with any other technology like Google, Facebook, Twitter etc.
■ Have the Vodka to celebrate your learning. You have dipped your
feet into one of the most powerful features of a platform (or any
platform for that matter) - How to integrate it with other applications
using APIs

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 81
Leave Your Feedback
To download the PDF copy of the presentation please navigate to URL
http://www.asagarwal.com/a-60-minutes-step-by-step-diy-guide-to-sales
force-rest-api-for-non-developers. And also please do not forget to
leave your comments/feedback/suggestions at this URL

If you got stuck anywhere and were able to resolve the issue, mention
that as a comment on the above mentioned blog post URL so that
others can benefit from your experience

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 82
Thank You !

For Daily Dose of Useful Tips & Tricks on


Salesforce.com, Please Visit
http://www.asagarwal.com

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 83
Document Change Log
Version Changes
1.0 First Release

1.1 Re-ordering of 1st 3 slides to make links it clickable on Slideshare

1.2 Changed the Slide Size

Visit asagarwal.com for daily dose of useful tips and tricks on Salesforce 84

You might also like