Using a service account to get users - Cloud

Talend Cloud APIs User Guide

Version
Cloud
Language
English (United States)
Product
Talend Cloud
Module
Talend API Designer
Talend API Tester
Talend Data Preparation
Talend Data Stewardship
Talend Management Console
Content
Design and Development > Designing APIs
Design and Development > Testing APIs

Use the service account and its token you created in previous sections to get users under your tenant.

The API to be used is https://api.<env>.cloud.talend.com/account/users.

Before you begin

  • Ensure that the service account to be used to issue API calls has the Users - Manage permission. The ID of this permission is TMC_USER_MANAGEMENT.

About this task

In this section, the following API call is issued:
method: GET
endpoint: https://api.<env>.cloud.talend.com/account/users
headers: {
 "Authorization": "Bearer <service_account_token>"
}
payload: N/A
It is implemented in Talend API Tester for demonstration purposes. In Talend API Tester, you can use an expression builder to dynamically retrieve the service account token from its related API request.

Procedure

  1. Select GET from the Method list and in the field aside, enter the user management endpoint to be used: https://api.<env>.cloud.talend.com/account/users

    Example

  2. Click Add header and in the name field that is displayed, enter Authorization and in the value field, enter Bearer and service account access token in plain text or click the to build a dynamic expression. Enter a whitespace to separate Bearer and the token.

    Example

    Since you need to renew the token once the current one expires, it is recommended to use an expression to enable this API request to dynamically use the latest token once it is renewed by the token API request.

    On Talend API Tester, you can use the expression builder to write the expression. Note that the token API request must have been saved in your repository. In the previous section, this API request was saved and named as Renew the SAT.

    This makes the value of Authorization look like this.
    Bearer ${"service-account 2021"."Service Account Token scenario"."Reniew the SAT"."response"."body"."access_token"}
  3. Send and save the request.

Results

A user list is returned with the status code 200.