This article explains how to connect to Salesforce using Postman to perform integration tests then retrieve record details from Salesforce.
Salesforce provides a Connected App to connect with the platform with any other application.
Getting started with Salesforce Manage Connected App
First, log in to Salesforce org and go to Setup then click on App manager
Click on New Connected App Button in the section.
Then you will see the page below
- Give the Name of the Application.
- Enter Contact Email and any additional information suitable for your application.
- Enable OAuth settings in API section.
- Enter a Callback URL. This is the URL that a user’s browser is redirected to after successful authentication. In this case we give https://login.salesforce.com/services/oauth2/callback as callback URL.
- Add Selected OAuth Scopes. For instance, Full access(full).
Click on Save button and after Click on Continue
You will be redirected to your Manage Connected App’s Page
After creating the Connected App, go and Click to reveal a link to get Consumer secret. Make a note of Consumer Key and Consumer Secret, as you need these details to authenticate the external application.
Then navigate to Manage and go to OAuth Policies section select IP restrictions as Relax IP restrictions.
Now we will see how to call and integrate Salesforce with Postman.
Postman is an application for interacting with HTTP APIs. It has powerful testing features and user GUI for making requests and reading responses.
Getting started with Postman
Install Postman by going to Postman APPs .
Integrating Salesforce using REST API
A) Setup the HTTP login request URL
We are going to set request URL by (Base URL + Parameters), see below the structure to construct request URL for Salesforce org
ConsumerKey: Consumer Key obtained from Manage Connected App. ConsumerSecret: Consumer Secret obtained from Manage Connected App. SalesforceUserName: Salesforce User ID. •SalesforcePassword: Provide the login credentials of Salesforce
B) Authenticating your request with Salesforce
Create a POST method and Copy the request URL as shown below and click on send.
Here we got Instance-URL, Access token, Token-type. This Access token will be used as a parameter value in Header to send any HTTP requests and get the response from Salesforce.
Retrieving record details from Salesforce
Now we will see how to get details of a record from Salesforce object using the GET. Use this URL.
a.Instance_url: Instance_url obtained in the same manner.
b.Object Name: As Account, Contact …
c. Id: Id of the SObject that you have selected.
To create a GET method, copy the URL and copy the Access token along with Token type in Header section as shown below
After Click on the send button. You will get all the Account details of that particular record as shown the picture below.
I hope you find this article useful. See you soon.