Using a service account to get users

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>

Before you begin

About this task

In this section, the following API call is issued:

method: GET
endpoint: https://api.<env>
headers: {
 "Authorization": "Bearer <service_account_token>"

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.


  1. Select GET from the Method list and in the field aside, enter the user management endpoint to be used: https://api.<env> service account to get users
  1. Click Add header and in the name field that is displayed, enter Authorization and in the value field, enter Bearer and the service account access token in plain text or click the expression builder icon to build a dynamic expression. Enter a whitespace to separate Bearer and the token.

    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. expression builder renew token

    In 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"."Renew the SAT"."response"."body"."access_token"}
  1. Send and save the request.


A user list is returned with the status code 200.