Use Postman

Introduction and How to Use Postman | Salesforce Developer Guide

Introduction

Postman is a computer application it is used for testing APIs (Application Programming Interfaces). Postman sends an HTTP request to the webserver and receives the response body from the server. there's no greater configuration or setting up of framework is needed even as sending and receiving requests in Postman. Postman is extensively utilized by Testers and developers for better trying out of applications. Postman allows us to check APIs using a graphical user interface.

Commonly used HTTP methods are:

  • GET: Retrieve data/information
  • POST: Add data/information
  • PUT: Replace data/information
  • PATCH: Update certain data/information
  • DELETE: Delete data/information

When testing APIs with Postman, we usually obtain different status codes. Some of the most common status codes are the followings:

  • 200: This code is used for a successful request.
  • 201: Data created successfully.
  • 400: Bad Request. 
  • 401: Unauthorized Access.
  • 403: Forbidden or Access Denied.
  • 404: Data Not Found.
  • 405: unsupported method.
  • 500: Internal Server Error.
  • 503: Service not available.

dont miss out iconDon't forget to check out: Salesforce Integration with Postman - The How-to Guide

How to Install the Postman App on your Computer:

Postman is an open-source application and it is obtainable to download for free of cost. It is similar to downloading and installing like any other computer application.

To download, the postman app on your computer visit https://www.postman.com/downloads/ and download the app as per your computer system OS. Postman app is available for the following OS:

  • Windows
  • Linux
  • Mac.
  • Postman also comes with a web version, you can use it on your web browser such as Chrome, Mozilla IE, etc.

How to Use Postman

Requirement - Retrieve and create account records in Salesforce org.

  • Authenticate Salesforce Org

Step 1: Configure a connected app in Salesforce org

Step 2: Open postman select the Authentication tab, choose OAuth2.0 from type

Step 3: Fill the value in fields i.e Access Token UR, client id, Client Secret (these values can be obtained from Salesforce connected app)

Step 4: Now click on the Get New Access Token button, a new pop-up will open where you have to fill in your org credentials i.e Username and password, after that, you will receive a new access token

  • Retrieve Account Records from Salesforce

Step 1: Choose a method and enter the request URL

Method - GET

 Request URL - <your salesforce instance>/services/data/v42.0/query/?q=SELECT+Name,Type+FROM+Account

Step 2: Set header

Key - Authorization 

Value -  Bearer<space><access-token> 

Click send, now will see the account record in the Response section.

dont miss out iconCheck out another amazing blog by Arun here: Learn All About Data Modeling in Salesforce

  • Create Account Records in Salesforce

Step 1: Choose method and enter the request URL

Method - POST

Request URL - <your salesforce instance>/services/data/v36.0/sobjects/Account/

Step 2: Set header 

Key - Authorization 

Value -  Bearer<space><access-token> 

Step 3: Set header 

Body - raw>JSON

{
    "Name": "Test Account from Postman"
}

Click send, now you can see the callout response/status (success or fail) in the Response section.

Responses

Popular Salesforce Blogs