While the variables are stored by default in the collection you can use Postman with environments to work with multiple CDP instances in parallel.
The pre-request script has been written to determine if an environment has been selected. If it has been, the environment variables will be used for the authorization. By default in Postman the environment variables will supersede the collection level variables.
⚠️ Using environments means that you will store Marketing Cloud credentials in clear in Postman. Do this at your own risk.
-
Using a browser, sign in to Postman
-
Open the main collection with this link
-
Select the Environments tab (item A in following screenshot)
-
Click CDP Template Environment (B)
-
Click on the “three dots” icon on the right (C) and select Export from the menu
This downloads a
CDP Template Environment.postman_environment.json
file. -
Close the browser tab. We'll continue the installation on the Postman app
-
In the Postman app, click Import
-
Drag and drop the JSON file you just downloaded in the gray zone
-
Click Import
-
Click on the Environments icon
-
Click on the “three dots” icon on the right of the environment template and select duplicate
This creates a
CDP Template Environment Copy
template. -
Click CDP Template Environment Copy
-
Rename the environment with something meaningful in relation with your Marketing Cloud instance (e.g.: “Playground 1”)
-
Set values in the CURRENT VALUE column for the following variables. If you need instructions for getting these variables go to: Configure the Collection
Variable | Example Value | Description | Used In Direct APIs | Used In Connect APIs |
---|---|---|---|---|
loginUrl | login.salesforce.com | Using login.salesforce.com will be fine unless you are using a sandbox. | X | X |
version | 52.0 | Salesforce API version number | X | |
clientId | 3MVG9l2zHsylwlpR6H5xByqIHvFbLVATgzkY... | Consumer key from the connected app. | X | X |
clientSecret | 775C20434DB475FC326765353AF5210D4... | Consumer secret from the connected app. | X | |
privateKey | -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA6spOAo1NhTsOhj19M ... rEOBZ458a3O4EOfHP1luZb4ZGrnTDRcA== -----END RSA PRIVATE KEY----- |
Contents of host.key file. | X | |
userName | [email protected] | User Name of the authorized user. | X | X |
password | superSecretPassword1! | Password of the authorized user. | X | |
securityToken | fVhwzeDFMrAh4IC9hS | Salesforce security token for the authorized user. Details for securing a token available here. | X |
-
Click Update and close the environments dialog
-
Select your environment from the environment dropdown
-
All requests will now use the selected environment instead of the collection level variables.