Introduction to the Salesforce REST API (using Postman) - Ballard Software
Introduction to the Salesforce REST API (using Postman) - Ballard Software
Ballard Software
Salesforce and Microsoft Software Development
Introduction to the
Salesforce REST API (us-
ing Postman)
This post is going to be a rather lengthy introductory course
on the Salesforce REST API. If you’re just looking for the
Postman collection, or would like to just follow along, click
here. We’ll discuss authentication, basic read operations,
SOQL queries, batch & composite queries, and querying with
an external key. We’ll also touch on the Salesforce
workbench.
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 1/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
Salesforce Setup
Once you’re logged in, from the gear icon in the top-right,
navigate to Setup. From the ‘Quick Find’ box on the left, type
in “App Manager” and select the menu item with the same
name. On this screen, you’ll see a number of pre-built connec-
tion points. Let’s add our own by selecting “New Connected
App” in the top-right.
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 2/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
Postman Setup
Be sure you’re also creating the fields for instance-url and ac-
cess-token above even though they are empty. More on this
below.
Authentication
Ok, so with the setup ceremony out of the way, let’s start hav-
ing fun. Below is an example authentication request to
Salesforce. Note this is a POST request, sent x-www-form-ur-
lencoded with a set of key/value pairs which are coming from
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 5/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 6/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
API Limits
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 7/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
The limits you see here are for a 24-hour period. Our devel-
oper account is limited to 15,000 API requests per day, and we
have 14,999 remaining, having used our first one to inquire
about the limits for our account. A keen eye will also note our
“Postman Client” app we defined earlier, has a limit range but
nothing is set. Apps can have their own API limit quotas po-
tentially as well, and may be something a Salesforce admin
sets for your app.
Basic Queries
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 9/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
SOQL Queries
The result set we get back from the query has our results (3)
and also a few interesting fields to note (2). The first is the to-
talSize and done parameters. If the value for done is false, you
will also see a top-level property called nextRecordsUrl that
will look like: /services/data/v44.0/query/01g2100000PeqVoAAJ-
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 10/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
Most often when you are using the Salesforce REST API, you
are doing so to connect it to an external business system
which has it’s own record identifiers/keys. Salesforce under-
stands this notion, and allows you to create properties on
your objects which are of type “External Id”.
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 11/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
case (3) > Fields & Relationships (4) and then add a new
record of type text (5) as the type of parameter for your key.
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 12/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 13/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
In our response we can see any errors were returned (2) and
the status code for each independent subrequest/response (3)
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 14/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
along with the payload that would be returned. The batch API
can also be used to perform PATCH, POST, and DELETE to
modify your Salesforce data, which I’ll discuss in the future.
Also, note how the response object from a prior query (1) can
later be referenced in a subsequent query (2) in the chain.
Each response from a composite query is wrapped in a body
object (3). Similar to the batch API, you can also use this to
create, update, and delete records instead of just querying it.
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 15/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
Salesforce Workbench
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 16/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
Final Thoughts
Kyle Ballard
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 17/18
6/12/23, 7:47 PM Introduction to the Salesforce REST API (using Postman) - Ballard Software
https://ballardsoftware.com/introduction-to-the-salesforce-rest-api-using-postman/ 18/18