Updating a user's email

Update a user's email address and keep assigned roles, groups, and workspaces.

Before you begin

  • Generate an access token:
    • For users, generate a personal access token. For further information, see Generating a Personal Access Token.
    • For service accounts, generate a service account token. For further information about how to generate a service account token, see Generating a service account token. Once generated, a service account token expires after 30 minutes. If it expires, generate a new token using the POST method at the endpoint https://api.{env}.cloud.talend.com/security/oauth/token.

Procedure

  1. Get the ID of the user for which you need to update the email address.

    • In Talend Cloud Management Console, when you click this user on the user list of the Users&Security page, this ID is displayed on the detail page of this user.

    • Or you can obtain IDs of all users via the following API request:

    GET https://api.<env>.cloud.talend.com/account/users
    
  2. Get the IDs of the groups to which this user belongs.

    • In Talend Cloud Management Console, these groups are listed in the Group(s) field of the detail page of this user. Then on the Users & Security > Groups page, find the IDs of these groups.

    • Or make the following API calls:

      1. Get all existing groups:

        GET https://api.<env>.cloud.talend.com/account/groups
        
      2. Get users of each group:

        GET https://api.<env>.cloud.talend.com/account/groups/<groupId>/users
        

        In the response, find the user along with the groups to which this user belongs, and note down the IDs of these groups.

  3. Collect the user’s roles and store the response in its original format. This helps you directly reuse the information in the body of other API requests.

    Example

    GET https://api.<env>.cloud.talend.com/account/users/<userId>
    
  4. Collect the user’s workspaces:

    Example

    GET https://api.<env>.cloud.talend.com/security/permissions?userId=<id>
    

    The workspace array in the response reads like

      [
          {
          "workspaceId": "60e476ad99e79c0afa70628e",
          "userId": "d2057821-58a1-4237-a56c-fbafc75c94a6",
          "permissions":["EXECUTE"]
          },
          {
          "workspaceId": "5ec4225b33f6c500015835ca",
          "userId": "d2057821-58a1-4237-a56c-fbafc75c94a6",
          "permissions":["PUBLISH", "MANAGE", "EXECUTE", "AUTHOR"]
          }
      ]
    
  5. Create a new user with updated email:

    Example

    POST https://api.<env>.cloud.talend.com/account/users?invite=true
    

    The request body reads like:

    {
      "active": "true",
      "email": "user_new_email_to_receive_invitation",
      "firstName": "string",
      "lastname": "string",
      "roleIds": [
        "role_id_retrieved_in_previous_steps"
      ]
    }
    
  6. Assign the new user to the same group:

    Example

    POST https://api.<env>.cloud.talend.com/account/users/{userId}/groups
    

    The request body reads like:

        [
            "ID_of_group1", 
            "ID_of_group2"
        ]
    
  7. Assign the new user the same workspace and workspace permissions:

    Example

    POST https://api.<your_environment>.cloud.talend.com/security/permissions/batch
    

    The request body reads like:

    [
      {
        "workspaceId": "workspace_id_1",
        "userId": "new_user_id",
        "permissions": [
          "EXECUTE"
        ]
      },
      {
        "workspaceId": "workspace_id_3",
        "userId": "new_user_id",
        "permissions": [
          "PUBLISH", "MANAGE", "EXECUTE", "AUTHOR"
        ]
      }
    ]
    
  8. Delete the user with the old email:

    Example

    DELETE https://api.us.cloud.talend.com/account/users/{userId}
    

Results

The user’s email address has been successfully updated, along with associated roles, groups, and workspace permissions.