Salesforce Data Cloud’s Connect REST API (Connect API) creates business value by organizing and simplifying interactions with Data Cloud services. It is the preferred platform for customers to construct solutions on top of Data Cloud, offering uniform implementation and testing practices. The Data Cloud Connect API Postman collection allows users to make the same API calls directly from Salesforce’s Connect interface, providing seamless integration of data across systems. This integration also allows for these APIs to be called in flows. In this blog post, you’ll learn how to use Postman to interact with Data Cloud data and metadata through the Connect API.

What is Postman?

Postman is an API platform for building and using APIs. Postman helps you to explore and test integrations with APIs. Postman can also store and manage API specifications, documentation, and test cases related to APIs. Postman offers built-in collaboration features, such as workspaces, in-line commenting, and version control, that help teams to deliver better APIs. You can learn more on Trailhead with the Postman API Client module.

What is the Data Cloud Connect API Postman collection?

The Data Cloud Connect API Postman collection consists of a collection of API request templates that you can use to test with Data Cloud. These API endpoints can access and query metadata like data lake objects (DLOs) and data model objects (DMOs). They can also query data like records in data lake objects and data model objects. In addition, the collection consists of API requests that can be used to insert and delete data into Data Cloud’s data lake.

Now that you have a basic understanding of Postman and the Data Cloud Connect API Postman collection, it’s time for us to show you how to use these API requests!

Image of the Salesforce Data Cloud Connect API collection in Postman

Step 1: Install the Postman application

First, we need to download and install the Postman desktop app.

Note: Data Cloud Connect REST API doesn’t support the Postman web app due to CORS limitations.

Step 2: Create a private public key pair

Next, we’ll generate a .key file and a .crt file (a private and a public key) to use later in the setup. To do this, we open a terminal on our computer and change directories to a preferred folder where we want to store our keys. Then, we run these commands shown below in the terminal and answer the series of questions.

Note: These are the terminal commands for a Mac please run the equivalent commands for a Windows machine if you are using a Windows machine.

We are then able to see our .crt.

CRT

Step 3: Set up a connected app

Next, we need to set up a connected app. This Postman collection uses Salesforce’s server-to-server JWT bearer flow to acquire an access token. Below are the steps to do so.

Important: These instructions require you to store your credentials in Postman. For a more secure process, use a different authentication method.

  • Log in to Salesforce.
  • In the Quick Find box under Setup, enter App Manager, and then select New Connected App.
  • Next, enter in these details:
    • Connected App Name: DC API
    • API Name: DC_API
    • Contact Email: Your email address (Make sure that this is a real email address as you will have to recover details from this email address)
  • Under API Heading, select Enable OAuth Settings.
  • Enter the callback URL: https://oauth.pstmn.io/v1/callback.
  • Select Use digital signatures.
  • Select Choose File and then select the host.crt file created in the Create a Private Public Key Pair section.
  • Under Selected OAuth Scopes, select these scopes:
    • Manage user data via APIs (api)
    • Perform requests at any time (refresh_token, offline_access)
    • Perform ANSI SQL queries on Salesforce Data Cloud data (cdp_query_api)
    • Manage Salesforce Data Cloud profile data (cdp_profile_api)
    • Manage Salesforce Data Cloud Ingestion API data (cdp_ingest_api)
  • Deselect Require Proof Key for Code Exchange (PKCE) Extension for Supported Authorization Flow
  • Select Save and continue.
  • We will make note of the Consumer Key and Consumer Secret values, which we will use later as the clientId and clientSecret variables in the Postman collection.
  • At the top of the new connected app, click Manage.
  • Then, select Edit Policies.
  • Under IP Relaxation, select Relax IP restrictions.
  • And finally, save your changes.

Step 4: Authorize the app

After the connected app is configured, we need to authorize our user with the connected app. This authorization will need to be performed one time only. Here are the steps:

  1. Construct a URL using this format:

YOUR_ORG_URL/services/oauth2/authorize?response_type=code&client_id=YOUR_CONSUMER_KEY&scope=api refresh_token offline_access cdp_profile_api cdp_query_api cdp_ingest_api&redirect_uri=https://oauth.pstmn.io/v1/callback

Important: This URL for this request includes all of the required custom Data Cloud scopes. All subsequent JWT bearer flow requests honor only the scopes in this request.

  1. Replace these values in our example url above with the following:
    • YOUR_ORG_URL is the fully qualified instance URL.
    • YOUR_CONSUMER_KEY is the consumer key noted when you set up the connected app.

The final URL we constructed looks like this.

Next, paste the URL into a browser and execute it, and then select Allow for each of the scopes requested in the modal that appears. If you receive an alert from the callback, select Open Postman.

To verify that everything is authorized, navigate to Setup. In the Quick Find box, enter Connected Apps OAuth Usage. You’ll want to confirm that you see your connected app with a user count of one.

Step 5: Fork the collection

Now that we have our connected app set up, we can start setting up Postman. We first need to fork the Salesforce Data Cloud Connect API collection in Postman.

Step 6: Configure the collection

The Postman collection uses a series of collection variables to streamline your requests. To use the collection, we need to update the collection variables.

  1. In your Postman workspace, select your forked Salesforce Data Cloud Connect APIs collection.
  2. Select the Variables tab.
  3. Add these values for your instance in the Current Value column.
  4. Finally, save your changes.

Note: There are more secure ways to do authentication without storing your credentials in Postman. We are using this approach to simplify the demo. This is by no means a recommendation or a best practice.

Image of a Postman collection’s variables setup page

Variable Example Value Description
loginUrl login.salesforce.com Use login.salesforce.com unless you’re using a sandbox.
dne_cdpInstanceUrl Use the URL from the Auth request in Postman, covered in the Authenticate the Collection section.
version 60.0 Salesforce API version number.
clientId Enter Client ID Consumer key from the connected app.
clientSecret Enter Client Secret Consumer secret from the connected app.
userName user@example.com User name of the authorized user.
password superSecretPassword1! Password of the authorized user.
securityToken SuperSecretSecurityToken Salesforce security token for the authorized user.
dne_cdpAuthToken Use the token from the Auth request in Postman, (covered in the “Step 7: Authenticate the collection” section below.

Step 7: Authenticate the collection

Connect APIs use the Salesforce authentication request process.

  • In Postman, run the Auth Request.

Postman’s test functionality parses the response body and sets the variables for dne_cdpAuthToken and dne_cdpInstanceUrl that are used in subsequent Connect API requests.

Image of a sample authorization request

  • Expand the collection and select Connect APIs.
  • Select Auth – Auth Request.
  • Click Send.

Step 8: Execute a request

Now, we will execute a sample request in Postman to get the metadata from our Data Cloud org.

Image of Postman console showing the metadata request expanded and the metadata we retrieved from our org

Conclusion

In this blog post, you learned how to access your Data Cloud data and metadata from Postman with the Connect REST API. You can now start experimenting with the Data Cloud Postman collection. We encourage you to learn more about Data Cloud APIs and Postman by checking out the resources below. In future blog posts, we will show you some more examples of how to work with Data Cloud data and metadata via the Connect REST API.

Resources

About the authors

Danielle Larregui is a Senior Developer Advocate at Salesforce focusing on the Data Cloud platform. She enjoys learning about cloud technologies, speaking at and attending tech conferences, and engaging with technical communities. You can follow her on X(Twitter).

Rachel Mahan is a Lead Technical Writer at Salesforce focusing on documentation for developers.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS