How to Connect Salesforce and Postman using REST API
For businesses to grow faster and more efficiently, sometimes we may require to integrate Salesforce, a cloud-based CRM solution with an external application such as SAP ERP as it cannot provide access to everyone. So, here Salesforce provides a framework called the connected app to integrate it with any external application using APIs and standard protocols. In this article, we are going to explain the creation of a connected app in Salesforce, a step-by-step process to connect to Salesforce CRM with Postman using REST API, and an example to retrieve and create a record using postman.
- Salesforce is a cloud-based CRM platform (Customer Relationship Management). It brings customers and companies together.
- It is one integrated CRM that gives all department including:
- Commerce and service
- It is written in Java and uses the REST API protocol.
- It is easy to use, customizable and is a mobile-based CRM.
Salesforce Connected App
Salesforce provides a Connected App to connect with the platform with any other application.
A connected app is an application that allows an external application to integrate with Salesforce using APIs and standard protocols.
Getting started with Salesforce Connected App:
Following are the steps to create a connected app in salesforce:
1. In Salesforce, navigate to Setup->Build->Create->Apps
2. Then go to Connected Apps for creation.
3. Now choose the New Button to create a new connected app.
4. Enter all the required information for the application.
5. Select Enable OAuth Settings.
6. Now provide a Callback URL and choose ‘Access and manage your data(api)‘ in Selected OAuth Scopes.
7. Click on Save and Continue.
8. Click on your connected app.
9. Now, make a note of consumer key and consumer secret as these are required to authenticate.
10. In order to get a consumer secret, click on Reveal.
Understanding Basics of Postman:
Postman is an application for interacting with HTTP API. It is an interactive and automatic tool for verifying the APIs. It works in the backend and makes sure that each API is working.
Getting Started with Postman:
Install Postman by going to Postman Apps or Google Chrome.
The above screen will be displayed after launching the postman.
Step-by-step procedure for Authentication, Get Operation and Post Operation.
Step 1: Authentication
- Authentication is used for getting access token and instance URL.In order to get access token, we have to set up the HTTP login request URL.
- In the login URL, Client_id, Client_secret, Username, Password, Grant_type are the required fields. The structure of Url is shown below:
- Use the ‘POST’ method for the login URL.
- Provide the URL below to login and click on Save.
On successful login, we will get instance_url, Access token and Token type. This access token is further used as a parameter in the header to send HTTP requests.
Step 2: Retrieving details of record from Salesforce
- In order to retrieve a record from salesforce ‘GET’ action is used. Below is the sample URL to fetch the details:
- Instance url: Instance url that we get in response of login URL.
- Object name: Object name includes standard objects like Account, Contact etc.
- Id: This is the salesforce Id of the particular record we are trying to fetch.
- Create a ‘GET‘ method and put a URL.
- In the headers section, copy access token with its token type as shown below:
- Now, click on Send and you will get details of the record in response.
- In order to create a new record in salesforce, we have to use the ‘POST‘ method.
- Below is the sample URL to create a new record:
- instance url: Instance URL that we get in response to the login URL.
- Objectname: Object name includes a particular object that we are trying to create.
- To create a record, use the ‘POST’ method and put the URL.
In the headers section, copy access token and in the body section, provide the details of a record in XML or JSON format. Here, I’m using the JSON format.
- Now, click on the send button.
- In response, you will get a Salesforce Id.
APPSeCONNECT is a smart and robust business application integration platform that seamlessly connects Salesforce with all your business applications to streamline operations and facilitate the free-flow of data across the platforms. By moving into the region of iPaaS, APPSeCONNECT proves to be a best-in-the-class platform that easily connects systems and automates the business process.
Now, you can easily connect all your business applications under one single platform to automate the business process!