Postman Application
Postman Application
Postman Application
Desktop App
Download and install the Postman app from Postman.
Web App
Not currently supported. Please use the desktop application.
Note: These instructions are designed for use in the Direct APIs which are the
recommended approach for invoking the CDP APIs. If you are going to be using the
Connect APIs some steps such as the Key Pair, Connected App Setup, and App
Authorization will not be required.
2. Open Terminal and change directories to any folder and run the following
commands
This creates a host.key and host.crt files in that folder. These will be used later in
the setup.
iv. Under API Heading, check the box for “Enable OAuth Settings”
vii. Select “Choose File” and select the host.crt file created in Create Private
Public Key Pair section
viii. Under “Selected OAuth Scopes” move the following from the “Available
OAuth Scopes” to “Selected OAuth Scopes”
App Authorization
At this point your connected app has been configured however there is a one time
setup requirement to authorize your user with the connected app.
<YOUR_ORG_URL>/services/oauth2/authorize?response_type=code&client_id=<YOUR_CONSUMER_
KEY>&scope=api refresh_token cdp_profile_api cdp_query_api
cdp_ingest_api&redirect_uri=https://oauth.pstmn.io/v1/callback
Notice the scope parameter in the above URL. It’s important that you select all the
required custom CDP scopes in this request. All further JWT bearer flow requests will
honor ONLY these scopes
Example URL:
https://aaroncates-20214005-
demo.lightning.force.com/services/oauth2/authorize?response_type=code&client_id=as
dlfjasldfjsaldfjaslfds&scope=api%20refresh_token%20cdp_profile_api%20cdp_query_api
%20cdp_ingest_api&redirect_uri=https://oauth.pstmn.io/v1/callback
2. This prompts a consent dialog asking permission for each of the scopes
requested above. Select Allow and you should be redirected back.
3. You may also get an alert from the callback. If you do, select Open Postman
4. Optional: If you want to verify everything is authorized correctly, in the Quick
Find search for “Connected Apps OAuth Usage”. Here you will see your
connected app and should see a user count of 1.
Option 1:
Option 2:
4. Click Fork
Using
login.salesforc
e.com will be
loginUrl login.salesforce.com X X
fine unless you
are using a
sandbox.
Salesforce API
version 52.0 version X
number
Consumer key
3MVG9l2zHsylwlpR6H5xByqIHvF from the
clientId X X
bLVATgzkY... connected
app.
Consumer
clientSecr 775C20434DB475FC326765353A secret from
X
et F5210D4... the connected
app.
User Name of
aaroncates@aaroncates-
userName the authorized X X
20210405.demo
user.
Password of
password superSecretPassword1! the authorized X
user.
Salesforce
security token
for the
securityTo authorized
fVhwzeDFMrAh4IC9hS X
ken user. Details
for securing a
token
available here.
4. Click Save.
Collection Authentication
Direct APIs
The collection is built to leverage the OAuth 2.0 JWT Bearer Flow for Server-to-Server
Integration for Salesforce Core authorization. The core token is then exchanged with the
off core server hosting CDP for a final authorization token.
NOTE: To simplify the use of the the collection this authorization process has been
configured to run automatically prior to each request and check if a valid token
exists.
This is accomplished by using the collection variables defined in the Configure the
Collection section combined with a pre-request script.
The script creates six new variables that are used for token generation and should not
be edited:
• dne_cdpTokenRefreshTime
• dne_cdpAssertion
• dne_cdpAuthToken
• dne_cdpInstanceUrl
• dne_cdpOffcoreToken
• dne_cdpOffcoreUrl
The Marketing Cloud authorization tokens are valid for 2 hours therefore when a token
is requested we create a new variable called dne_cdpTokenRefreshTime that stores the
time the token was generated. Each subsequent call will use this refresh time to
determine if a new token should be requested.
Connect APIs
The connect APIs leverage the traditional Salesforce authentication request process. You
must first run the Auth Request first and we leverage Postman's tests functionality to
parse the response body and set the variables
for dne_cdpAuthToken and dne_cdpInstanceUrl that are used in the remaining Connect API
calls.
Execute a Request
1. Expand the collection and select the Profile API -> Metadata - DMO request
2. Click Send
At this point, if your environment is correctly set up, you should see a 200 OK status. This
means that you have successfully authenticated with Salesforce CDP and that you can
now use the other collection’s requests.
See additional documentation for more information on how to keep the collection up to
date and work with multiple Marketing Cloud instances.
1. Expand the collection and select the Salesforce data cloud API -> Direct API ->
Query API -> Query.
2. Please on “Follow Authorization header” in setting tab.
3. Add SQL query in Body tab with {“SQL query” }
4. Use Post method to send request (api/v1/query).