Duplicating a workspace's permissions for a list of users on another workspace - Cloud

Talend Cloud APIs User Guide

Version
Cloud
Language
English
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
Last publication date
2024-03-15

Before you begin

  • You must have Environment Administrator role in Talend Management Console.

About this task

You can access the Management Console API via this link. You'll find a list of the URLs corresponding to each data center in Talend Cloud regions and URLs.

Procedure

  1. Use the GET /orchestration/workspaces endpoint to retrieve the IDs of the source and target workspaces.
    You can narrow the search to a single environment by using the query=environment.name=={environmentName} query parameter.

    Example

    GET https://api.us.cloud.talend.com/orchestration/workspaces?query=environment.name==default
  2. Use the GET /security/permissions endpoint with the ?workspaceID={workspaceID} query parameter to retrieve the list of users and their permissions on the source workspace.

    Example

    GET https://api.us.cloud.talend.com/security/permissions?workspaceId=5c9212a48c320343cbb5fc4b
    The response body will contain the users' IDs and permissions on the workspace.
    [
        {
         "workspaceId": "5c9212a48c320343cbb5fc4b",
    "userId": "e8f79686-821b-491e-b796-86821b491eb2",
            "permissions": [
                "AUTHOR",
                "MANAGE",
                "PUBLISH"
            ]
        },
        {
              "workspaceId": "5c9212a48c320343cbb5fc4b",
          "userId": "8116dfb5-3a80-4be2-945c-71a7db6892e5",
            "permissions": [
                "PUBLISH",
                "MANAGE",
                "VIEW"
            ]
        },
        {
             "workspaceId": "5c9212a48c320343cbb5fc4b",
          "userId": "3b7f0e11-4e93-4587-95b2-1ae6292fbb5b",
            "permissions": [
                "MANAGE",
                "EXECUTE",
                "AUTHOR",
                "VIEW"
            ]
        }
    ]
  3. Copy the body of the response.
  4. Use the POST (if the workspace is new) or PUT (if the workspace already has users) /security/permissions/batch endpoint to assign permissions to the users of the workspace.
    Paste the copied information to the body of the request, replacing the workspace ID with the target workspace's ID.

    Example

    POST https://api.us.cloud.talend.com/security/permissions/batch
    [
        {
         "workspaceId": "9d9212a67c320343chh5fc7l",
    "userId": "e8f79686-821b-491e-b796-86821b491eb2",
            "permissions": [
                "AUTHOR",
                "EXECUTE",
                "MANAGE",
                "PUBLISH",
                "VIEW"
            ]
        },
        {
              "workspaceId": "9d9212a67c320343chh5fc7l",
          "userId": "8116dfb5-3a80-4be2-945c-71a7db6892e5",
            "permissions": [
                "PUBLISH",
                "MANAGE",
                "EXECUTE",
                "AUTHOR",
                "VIEW"
            ]
        }
    ]
  5. To validate that permissions are set correctly on the target workspace, use the GET /security/permissions endpoint with the ?workspaceID={workspaceID} query parameter.

    Example

    GET https://api.us.cloud.talend.com/security/permissions?workspaceId=9d9212a67c320343chh5fc7l