Connect Postman to Salesforce

Tram Ho

Setup Cross-Origin Resource in Salesforce

Need to add 2 URLs https://*.postman.com and https://*.postman.co to CORS for Salesforce to allow Postman requests. From the Setup screen, type cors In the Quick Find box.

  1. Click New.
  2. Enter https://*.postman.com .
  3. Click Save .
  4. Add more https://*.postman.co as 1~3
  5. Click Save. image.png

Set Up and Connect Postman

Sign Up to Postman and create a Workspace

  1. If you already have a Postman account, then log in to Postman with your account, if you don’t have an account, create a new Postman account and log in.
  2. Select Workspaces from the menu.
  3. Create a new Workspace.
  4. Name your workspace SalesforceCollection .
  5. Select Personal .
  6. Click the Create Workspace button.

Fork the Salesforce Collection

Open the public Salesforce Developers workspace and create a fork of the Salesforce APIs collection.

  1. In Collections, Select Salesforce Platform APIs and expand it. image.png
  2. Click on the Fork icon to create a fork of this collection.
  3. Import MySalesforceAPIFork .
  4. Keep SalesforceCollection as the Workspace. image.png
  5. Click the Fork Collection button.

Now this Salesforce Api collection is actually in your Postman. Next we need to connect this collection to SF via authorize.

Authorize

Need to authenticate with Salesforce to access APIs..

Make sure you are logged into an SF account in an open browser.

  1. In Postman, under Collections, select Salesforce Platform APIs .
  2. Open Authorization tab.
  3. Select Type OAuth 2.0.
  4. Click the Get New Access Token button.
  5. Authorization screen appears

image.png

  1. Allow “Salesforce Platform APIs Collection for Postman” access to your SF.
  2. Click the Allow button
  3. The Manage Access Tokens Dialog is displayed. In Manage Access Tokens display information: Token Name, Access Token, Token Type, instance_url, issued_at, signature, and scope image.png
  4. Copy instance_url to use in step 12.
  5. Click the Use Token button.
  6. Open the Variables .
  7. Paste the instance_url copied in step 9 into the _endpoint line of the CURRENT VALUE column.
  8. Save.

KIỂM TRA

image.png

 

Share the news now

Source : Viblo