Hi,
You can use the following options to connect to Salesforce using REST API and Postman:
- Create a Connected App manually - is a bit complicated, because of the settings
- Import Salesforce platform API collection to Postman - contains many pre-defined profiles, requires some configuration, but is easier to use
Please note that API may not work / may not be fully supported in trial version. To work with Salesforce API for free, it is recommended to use a
Developer version, which supports API connection and doesn't expire.
1. Create a Connected App manuallySign into your Salesforce account, go to the settings and search for
App Manager:
Click on
New Connected App:
Fill the required fields, enable
OAuth Settings and set
Callback URL to https://login.salesforce.com/services/oauth2/success:
Choose the permissions (OAuth Scopes) and Save the app:
Go to
Manage Connected Apps and click on the created application:
Click on
Manage Consumer Details to get the Consumer Key and Secret:
Consumer Key is later used as Client ID and
Consumer Secret is used as Client Secret:
Prepare your security token. If you don't have the security token, you have to reset it and receive it via email:
To connect to the Salesforce via API using a Postman, you have to first get the token. Check the
Salesforce OAuth endpoints. When getting the token, you have to use the following params:
grant_type - "password"
client_id - use consumer key
client_secret - use consumer secret
username - your username
password - password+security token
The Headers should be set to:
Postman-Token: <calculated when request is sent>
Host: <calculated when request is sent>
content-type: application/x-www-form-urlencoded
You may also need to change some other settings to make a successful API call. If you are getting the error: {"error":"invalid_grant", "error_description":"authentication failure"}, you may need to set your
API relaxation to Relax IP restrictions:
You also may need to
allow OAuth username-password flows:
2. Import Salesforce platform API collection to PostmanGo to the Salesforce API collections on
Postman website. Then make a fork, to get the Salesforce API definitions to your Postman.
After the collection is available in your Postman, click on
Authorization. Scroll down and click on
Get New Access Token:
You will be redirected to your Salesforce account. You may need to sign in. Then you have to
allow access for Postman:
If your call is authenticated, you will get the success notification:
Then you will be redirected to Postman:
Click on
Use Token:
Now, you should have an API access to your Salesforce account. To select the records, you have to click on
REST folder in you Salesforce Platform API collection and choose
Query:
You have to enter your SOQL query to get the records:
You may get an error "Invalid URI". In this case, you have to check if {{_endpoint}} variable contains the value. If not, you have to set it in variables.