Copy a catalog item

post

/api/20210901/catalog/{type}/{id}/actions/copy

Create a copy of a catalog item with a given type and id to the same folder or a different folder. Includes the option to specify a different name for the copy and whether to overwrite an existing item with the same name.

Request

Path Parameters
  • Catalog item ID in base64url format.
  • Type of catalog item. The content types that this API supports include folders, workbooks, subject areas, analyses, dashboards, dashboard pages, reports, connections, datasets, data flows, sequences, scripts, and semantic models.
Supported Media Types
Request Body - application/json ()
Root Schema : schema
Type: object
Show Source
Back to Top

Response

Supported Media Types

200 Response

Successful operation
Body ()
Root Schema : CatalogItem
Match All
Show Source
Nested Schema : Discriminator: type
Type: object
Show Source
Nested Schema : CatalogItemIdRef
Type: object
Show Source
Nested Schema : CatalogItemParentIdNameRef
Type: object
Show Source

400 Response

Bad Request (invalid query parameters, malformed headers, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

401 Response

Unauthorized (missing or expired credentials, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

403 Response

Forbidden (missing permissions for operation, request denied for unspecified reason, and so on).
Body ()
Root Schema : Error
Type: object
Show Source

404 Response

Not Found. The requested resource was not found.
Body ()
Root Schema : Error
Type: object
Show Source

500 Response

Internal Server Error. The server encountered an unexpected condition preventing fulfilment of the request.
Body ()
Root Schema : Error
Type: object
Show Source
Back to Top

Examples

These examples show you how to copy a catalog object with a given type and id.

  • Example 1 - Copy a workbook into the same folder
  • Example 2 - Copy a workbook into a different folder
When you copy an object, you can specify several, optional parameter in the request body:
  • destId - Destination path where you want to save the copied object. If specified, none of the other parameters are used.
  • destParentId and newItemName - Copies the object to a specific destination folder and gives the copied object a new name. The new name is not Base64URL-safe encoded.
  • newItemName - New name for the copied object. If you don't specify destParentId, a copy is created in the same folder with the new name.

Example 1 - Copy a workbook into the same folder

In this example, you create a copy of a workbook called MySalesWorkbook in the same folder. The object ID of the workbook is /@Catalog/shared/Sales/MySalesWorkbook which has the Base64URL-safe encoded id value L0BDYXRhbG9nL3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s

The new workbook is named MySalesWookbookCopy because the option newItemName is not provided.

cURL Example:

Run the cURL command with the required type and id:

curl -i \
     --header 'Authorization: Bearer <token>' \
     --header 'Content-Length: 0' \
     --request POST 'https://<hostname>/api/20210901/catalog/workbooks/L0BDYXRhbG9nL3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s/actions/copy'

Example of Request Body

None required for this example

Example of Response Body

Status 200:

Example 2 - Copy a workbook into a different folder

In this example, you copy a workbook called MySalesWorkbook into a different folder. The object ID of the workbook is /@Catalog/shared/Sales/MySalesWorkbook which has the Base64URL-safe encoded id value L0BDYXRhbG9nL3NoYXJlZC9TYWxlcy9NeVNhbGVzV29ya2Jvb2s

The object ID of the destination folder is /@Catalog/shared/NewSales which has the Base64URL-safe encoded destParentId value L0BDYXRhbG9nL3NoYXJlZC9OZXdTYWxlcw

cURL Example:

Run the cURL command with the required id and destId:

curl -i \
     --header 'Authorization: Bearer <token>' \
     --header 'Content-Type: application/json' \
     --request POST 'https://<hostname>/api/20210901/catalog/workbooks/L0BDYXRhbG9nL3NoYXJlZC9NeUZvbGRlci9NeVNhbGVzV29ya2Jvb2s/actions/copy' \
     --data '{"destId": "L0BDYXRhbG9nL3NoYXJlZC9OZXdTYWxlcw"}'

Example of Request Body

{"destId": "string", 
      "destParentId": "string", 
      "newItemName": "string", 
      "overwrite": true, 
      "createIntermediateFolders": true}

For example:

{"destParentId": "L0BDYXRhbG9nL3NoYXJlZC9OZXdTYWxlcw" }

Example of Response Body

Status 200:
{    "owner": "<user-name>",
    "name": "MySalesWorkbook copy",
    "description": "",
    "id": "L3NoYXJlZC9OZXdTYWxlcy9NeVNhbGVzV29ya2Jvb2sgY29weQ",
    "lastModified": "2024-02-27T17:15:46Z",
    "type": "workbooks",
    "parentId": "L3NoYXJlZC9OZXdTYWxlcw"
}
Back to Top