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:
![salesforce app manager step by step](https://www.promcase.com/saleforce_app_manager.png)
Click on
New Connected App:
![salesforce create new connected app](https://www.promcase.com/salesforce_app_manager_new_connected_app.png)
Fill the required fields, enable
OAuth Settings and set
Callback URL to https://login.salesforce.com/services/oauth2/success:
![salesforce create connected app rest api example](https://www.promcase.com/salesforce_create_new_connected_app_rest_api.png)
Choose the permissions (OAuth Scopes) and Save the app:
![salesforce rest api permissions oauth scopes](https://www.promcase.com/salesforce_create_new_connected_app_oauth_permissions.png)
Go to
Manage Connected Apps and click on the created application:
![salesforce manage connected apps rest api](https://www.promcase.com/salesforce_manage_connected_apps_rest_api.png)
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:
![salesforce rest api postman client id client secret](https://www.promcase.com/salesforce_connected_app_rest_api_get_client_id_client_secret_consumer_key_consumer_secret.png)
Prepare your security token. If you don't have the security token, you have to reset it and receive it via email:
![salesforce get security token reset](https://www.promcase.com/salesforce_reset_security_token_get_security_token.png)
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:
![salesforce rest api ip relaxation](https://www.promcase.com/salesforce_rest_api_connected_app_settings_ip_address_relaxation.png)
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:
![salesforce rest api postman authorization get new access token](https://www.promcase.com/salesforce_postman_authorization_rest_api.png)
You will be redirected to your Salesforce account. You may need to sign in. Then you have to
allow access for Postman:
![salesforce allow access postman](https://www.promcase.com/salesforce_postman_allow_access_rest_api.png)
If your call is authenticated, you will get the success notification:
![salesforce postman call authenticated](https://www.promcase.com/salesforce_postman_api_all_authenticated.png)
Then you will be redirected to Postman:
![salesforce postman authentication complete](https://www.promcase.com/salesforce_postman_get_new_token_authentication.png)
Click on
Use Token:
![salesforce postman access token rest api](https://www.promcase.com/salesforce_postman_get_new_access_token.png)
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:
![salesforce postman rest api select query](https://www.promcase.com/salesforce_postman_select_query.png)
You have to enter your SOQL query to get the records:
![salesforce postman soql select query](https://www.promcase.com/salesforce_get_records_select_query_postman_rest_api.png)
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.