Skip to main content
线上 Trailblazer Community 现在是只读模式。Trailblazer Community 很快将迁移到 Slack 中,方便后续交流。阅读常见问题 | 获取帮助

Set Up and Connect Postman

Sign Up for Postman and Create a Workspace

Postman has two options for working with its app: desktop and web. You use the web browser app for this project.

  1. Sign in to your Postman account or sign up for an account.
  2. Select the Workspaces menu.
  3. Click Create.
  4. Name your workspace SalesforceCollection.
  5. Set who can access to Only you and invited people.
  6. Click Create Workspace.

Fork the Salesforce Collection

  1. Open the public Salesforce Developers workspace to create a fork of the Salesforce APIs collection.
  2. In Collections, select Salesforce Platform APIs to expand it.
  3. Click Use and select Fork.
  4. Keep SalesforceCollection as the Workspace.
  5. For Fork label, enter MySalesforceAPIFork.
  6. Click Use Collection.

You now have the collection ready in Postman. Let's use the collection to authorize your org and test it.

Update Postman Collection’s Authentication

  1. Be sure you're logged in to only one Trailhead Playground in your browser.
  2. In Postman, under Collections, Salesforce Platform APIs should be selected.
  3. Select the Variables tab.
  4. Overwrite the default clientId value with your External Client App’s Consumer Key.
  5. Fill the clientSecret value with your External Client App’s Consumer Secret.
  6. Select the Authorization tab.
  7. Change Grant Type to Authorization Code (With PKCE).

Authorize Your Org

You need to authenticate with Salesforce to access the APIs. Authentication grants you an access token that's valid for a certain duration. Repeat this process whenever your access token expires.

  1. Be sure No Environment is selected.
  2. Click Get new access token.
Note

If you're not logged in to a Trailhead Playground or Salesforce org, a browser tab opens with the Salesforce login screen. Enter the username and password you saved in step 1 to log in.

  1. Click Allow to let the “Salesforce Platform APIs Collection for Postman” access your Trailhead Playground.

    In the Allow Access? Dialog, click Allow to allow the Salesforce APIs Collection for Postman to access your basic information and to access and manage your data, or click Deny. To revoke access at any time, go to your personal settings.
  1. A success message appears briefly, and then you're redirected to the Manage Access Tokens dialog.

    The Manage Access Tokens box shows the Token Name, Access Token, Token Type, instance_url, issued_at, signature, and scope
  1. Verify that the instance_url points to your Trailhead Playground.
  2. Copy the instance_url to use in step 9. Be sure to copy only the URL with no extra characters.
  3. Click Use Token.
  4. Open the Variables tab.
  5. In the _endpoint row, VALUE column, paste the instance_url value that you copied in step 6.

A Quick Connection Test

Let's verify that the connection is working.

  1. In Collections, select Salesforce Platform APIs to expand it.
  2. Select REST to expand it.
  3. Select GET Limits.
    Limits opens in the main panel.
  4. Click Send.

    Postman GET Limits tab with Body response displayed in the main panel. Status shows 200 OK.
  1. Verify that the status is 200 OK.
    Under the Settings tab, you may need to turn Follow Authorization header configuration ON to retain authorization header when a redirect happens to a different hostname.

    Follow Authorization header setting under Get Request Settings

You've successfully authenticated with Salesforce. Now you can use other requests in the collection.

Post an Account

You just pulled some data from the org. Let's try adding some new data to the org.

  1. Under REST, select SObject, and then select POST SObject Create.
  2. Open the Params tab.
  3. Under Path Variables, in the SOBJECT_API_NAME row, VALUE column, enter Account.
  4. Open the Body tab.
  5. Replace the body text with this code:
    {
      "Name": "Postman",
      "BillingState": "CA"
    }
  6. Click Save.

    Save and Send in UI.
  1. Click Send.
    Postman returns the id for the new account.

    Postman with SObject Create displayed in the main panel showing the replaced Body and Send results. Status shows 201 Created.
  1. Verify that the status is 201 Created.
Note

If you don't get the status 201 Created then you might be signed into a different org. Verify that your instance_url is set to your Trailhead Playground.

  1. Open the authorized Playground.
  2. From the App Launcher (), find and open Accounts.
  3. Verify that the new account is now there.

Excellent! You've set up Postman to interact with your org. The Salesforce APIs for Postman collection that you loaded will aid you in your quest to discover the Salesforce APIs.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈