How to Connect Salesforce and Postman using REST API

How to Connect Salesforce and Postman using REST API

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:

  • 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:
    • Marketing
    • Sales
    • 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.

Integrate-Business-Apps-through-APPSeCONNECT

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

salesforce-build

2. Then go to Connected Apps for creation.

salesforce-connected-app

3. Now choose the New Button to create a new connected app.

salesforce-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.

salesforce-connected-app-postman

Integrate-Business-Apps-through-APPSeCONNECT

8. Click on your connected app.

postman-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.

launch-postman

The above screen will be displayed after launching the postman.

Integrate-Business-Apps-through-APPSeCONNECTIntegrating Salesforce using 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:
https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=YourConsumerKey&client_secret=YourConsumerSecret&username=SalesforceUserName&password=SalesforcePassword
  • Use the ‘POST’ method for the login URL.
  • Provide the URL below to login and click on Save.

integrate-salesforce-postman

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:
  • Create a ‘GET‘ method and put a URL.
  • In the headers section, copy access token with its token type as shown below:

salesforce-records

  • Now, click on Send and you will get details of the record in response.

salesforce-record-details

Integrate-Business-Apps-through-APPSeCONNECTStep 3: Creating a new record in salesforce

  • 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:
  • 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.

salesforce-new-record

  • Now, click on the send button.
  • In response, you will get a Salesforce Id.

salesforce-id


Integrate-Business-Apps-through-APPSeCONNECT

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!

You may also like:
How to Upload a Document in Salesforce Files Using Rest API
Payment Synchronization between SAP Business One and Salesforce
Global Variables in Salesforce – All You Need To Know

Team Veon