How to Connect Salesforce with Postman

Share This Post

Connecting Salesforce with Postman is an essential skill for developers and administrators who want to test APIs, automate processes, or interact with Salesforce data programmatically. Postman, a powerful API testing tool, allows you to send requests to Salesforce and receive responses, making it easier to develop and debug your integrations. In this blog post, we’ll walk you through the steps to connect Salesforce with Postman.

Prerequisites

Before we start, make sure you have the following:

  • A Salesforce account with API access (you can use a Salesforce Developer Edition if needed).
  • Postman is installed on your machine. You can download it from Postman’s official website.

Step 1: Set Up a Connected App in Salesforce

To connect Postman to Salesforce, you must create a Connected App in Salesforce to obtain the necessary API credentials.

  1. Log in to Salesforce: Use your credentials to log in to your Salesforce instance.
  2. Navigate to Setup: Click on the gear icon in the top right corner and select Setup.
  3. Search for “App Manager”: In the Quick Find box, type “App Manager” and click on App Manager under Apps.
  4. Create a New Connected App:
    • Click New Connected App in the top right corner.
  • Fill in the Basic Information:
    • Connected App Name: Postman Integration
    • API Name: Postman_Integration
    • Contact Email: [Your Email]
  • Under API (Enable OAuth Settings):
    • Check Enable OAuth Settings.
    • Set the Callback URL to https://oauth.pstmn.io/v1/callback (Postman’s OAuth callback URL).
    • Under Selected OAuth Scopes, add the following:
      • Full Access (full)
      • Access and manage your data (API)
  • Ensure the Require Secret for Web Server Flow is checked.
  • Save and Continue: Click Save. You’ll need to wait a few minutes for the app to be created.
  • Copy the Consumer Key and Consumer Secret: Once the app is created, you’ll receive a Consumer Key and Consumer Secret. Save these; you’ll need them for Postman.

Step 2: Authenticate with Salesforce in Postman

Now that you have your Connected App, you can authenticate Salesforce using Postman.

  1. Open Postman: Launch the Postman application on your machine.
  2. Create a New Request:
    • Click on New and then select Request.
    • Name your request Salesforce OAuth 2.0 and save it in a new or existing collection.
  3. Set Up the Authorization:
    • In the request tab, navigate to the Authorization section.
    • From the Type dropdown, select OAuth 2.0.
    • Click on Get New Access Token.
  4. Fill in the OAuth 2.0 Details:
    • Token Name: Salesforce Token
    • Grant Type: Authorization Code
    • Callback URL: https://oauth.pstmn.io/v1/callback
    • Auth URL: https://login.salesforce.com/services/oauth2/authorize (use https://test.salesforce.com if you’re using a sandbox)
    • Access Token URL: https://login.salesforce.com/services/oauth2/token
    • Client ID: [Your Connected App’s Consumer Key]
    • Client Secret: [Your Connected App’s Consumer Secret]
    • Scope: Leave this empty.
    • State: Leave this empty.
    • Client Authentication: Send as Basic Auth Header.
  5. Request Token:
    • Click on Request Token.
    • This will redirect you to the Salesforce login page. Log in with your Salesforce credentials.
    • Once authenticated, you will receive an access token. Postman will display this token in the Manage Access Tokens section.
  6. Use the Access Token:
    • Click Use Token to apply the token to your request.
    • You’re now authenticated and can send requests to Salesforce.

Step 3: Send Requests to Salesforce

With your OAuth 2.0 token, you can now interact with Salesforce using Postman.

  1. Create a New Request: In your collection, create a new request to interact with the Salesforce API.
  2. Set the Method and URL:
    • Set the method to GET, POST, PATCH, etc., depending on what you want to do.
    • For example, the URL will be in the format https://yourInstance.salesforce.com/services/data/vXX.X/sobjects/Account/
    • to interact with the Account object. Replace yourInstance with your Salesforce instance (e.g., na55, eu23) and vXX.X with the API version (e.g., v55.0).
  3. Send the Request:
    • Click Send to execute the request.
    • You should see the response from Salesforce in the Postman response window.

Step 4: Automate and Extend

Now that you’ve successfully connected Salesforce with Postman, you can:

  • Save Requests: Save your requests in collections for easy access.
  • Automate: Use Postman’s automation features, such as running a collection of requests in a sequence.
  • Test APIs: Perform extensive testing on Salesforce APIs, including testing CRUD operations on records, querying data, and more.

Conclusion

Connecting Salesforce with Postman is a powerful way to interact with your Salesforce data and automate API testing. By following the steps outlined in this guide, you can easily set up a connection and start sending requests to Salesforce in no time. This skill not only improves your efficiency but also enhances your ability to troubleshoot and develop robust Salesforce integrations.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Validation Rule Practice Question – Part 2

Validation rules are an essential feature in Salesforce that ensures data quality by enforcing specific conditions when users input data into fields. Whether you’re a