SFMC Tips #11 : How to Execute Basic Setup for Salesforce Marketing Cloud’s REST API using Talend API Tester
I often come across examples of executing Salesforce Marketing Cloud’s REST API using POSTMAN. However, I have a preference for using Talend API Tester, a Google Chrome extension. In my articles, I will demonstrate how to execute Salesforce Marketing Cloud’s REST API using Talend API Tester.
This article will cover the setup of the API integration interface, the installation of Talend API Tester, and the process of requesting an access token from the authentication server:
- Setting up the REST API integration interface
- Installing Talend API Tester
- Requesting an “Access Token” from the server
There is a reason for this approach. Obtaining an access token is a common step for all REST API executions, and it is a Basic Setup for executing REST APIs.
In the future, I would like to create articles demonstrating the execution of various REST APIs while referencing the basics covered in this setup article.
Setting up the API Integration Interface
Start by configuring the API integration interface from the Salesforce Marketing Cloud Setup screen.
From the left menu of Setup, choose Platform Tools > Apps > Installed Packages.
Next, click the “New” button in the top right corner.
Choose a “package name” and “save” it.
Click “Add Components”.
Select “API Integration” and click “Next”.
Choose “Server-to-Server” and click “Next”.
Next is the configuration of scopes (permissions for what the API can do). If these scopes are not set correctly, the subsequent requests will not be successful. For testing purposes, check all scopes for now. You can edit these scope settings later.
*If you want to restrict the scope, refer to the page linked below. For example, for /interaction/v1/events, you need to set two Permission IDs, 1018 and 1220.
After completing the setup, you will see the following information in the red-highlighted area:
- Client Id
- Client Secret
- Authentication Base URL
- REST Base URL
Copy these and store them securely, ensuring that this information does not leak externally.
Installing Talend API Tester
Next, install “Talend API Tester” from the Google Chrome Web Store. Search for it in the Web Store.
Install “Talend API Tester — Free Edition”.
I recommend pinning it to your extension bar. (Option)
Requesting an “Access Token” from the Authentication Server
Once the installation is complete, open Talend API Tester. In the Requests tab, select POST from the METHOD dropdown.
Enter the endpoint (connection point) in the SCHEME. Also, input the previously noted “Authentication Base URL”. Do not confuse it with “REST Base URL”.
https://[Authentication Base URL].auth.marketingcloudapis.com/v2/token
Next, in the HEADERS section, input the following:
- Content-Type in the left pane
- application/json in the right pane
Finally, in the BODY, input the following:
{
"grant_type": "client_credentials",
"client_id": "[Client ID]",
"client_secret": "[Client Secret]",
"account_id": "[MID]"
}
Input the Client Id and Client Secret that you noted earlier. MID is the 9-digit company code displayed when you click on the company name in the upper right of the Salesforce Marketing Cloud screen.
After entering all the information, click the “Send” button.
Scroll down the screen. If you receive a 200 OK response, it’s successful.
Scrolling down will reveal the access token. This token has a lifespan of 18 minutes (1080 seconds).
Below is an example of an access token. Copy your access token and use it. If the access token expires, request it again and use a different access token.
eyJhbGciOiJIUzI1NiIsImtpZCI6IjQiLCJ2ZXIiOiIxIiwidHlwIjoiSldUIn0.eyJhY2Nlc3NfdG9rZW4iOiIyYUFnRWlIRmx2dE9hTXJaMlA5ZUREbWgiLCJjbGllbnRfaWQiOiJiNGZycXFiY253c2txM3phNzRzMXVlY2kiLCJlaWQiOjUyNjAwMzc1MCwic3RhY2tfa2V5IjoiUzEyIiwicGxhdGZvcm1fdmVyc2lvbiI6MiwiY2xpZW50X3R5cGUiOiJTZXJ2ZXJUb1NlcnZlciIsInBpZCI6NjkwfQ.Aoc1DES0flvSQ9HErDctzonfCrSoSNooXqrKDXR8_eE.ZH8skFNf_idFJrJXq78mK87gui7bxvxKC5vtTu2SeI-kgtGY4-jopnVXu6eiBSkF0XS7d1opcZ6D4oW3ca85s64jsijujkjm-BO5hApUpwVy6Hx51wE1exEyFABiMTTGHgj5f1IAFkMr1X9GcO2TLjt_RIkyv9ys7jcXu
To reuse this configuration in Talend API Tester, save it with a name.
Decide on a request name (e.g., Access Token Issuance), especially if it’s the first time using Talend API Tester. Create a project by clicking “Create” after clicking on the project for saving.
Once the directory is created and the path is complete, click the “Save” button.
That concludes the process. Always remember to save the created request so you can use it when needed.
*Your Talend API Tester’s data is not saved in the cloud, it is stored locally in your browser’s storage. If you uninstall the extension or change devices, you cannot recover your data.
Conclusion
In summary, this article covered the setup of the API integration interface, installation of Talend API Tester, and the process of requesting an access token from the authentication server. These steps provide the foundational setup required for executing Salesforce Marketing Cloud’s REST API using Talend API Tester.
Thank you for reading.
Nobuyuki Watanabe
https://www.linkedin.com/in/nobuyuki-watanabe/ (+Follow me)