Copy a catalog item
/api/20210901/catalog/{type}/{id}/actions/copy
Request
-
id(required): string
Catalog item ID in base64url format.
-
type(required):
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.
- application/json
object
-
createIntermediateFolders: boolean
Create all intermediate folders if any folder in the parent folder hierarchy doesn't currently exist.
-
destId: string
Catalog item identifier for destination item.
-
destParentId: string
Parent folder id.
-
newItemName: string
Name for the new catalog item that you copy.
-
overwrite: boolean
If specified and true, overwrite the destination catalog item if it exists.
Response
- application/json
200 Response
-
object
CatalogItemIdRef
-
object
CatalogItemParentIdNameRef
-
object
Discriminator: type
Discriminator:
{ "propertyName":"type" }
object
-
description: string
Catalog item description, if any
-
lastModified: string
(date-time)
Catalog item last modified date and time
-
owner: string
Catalog item owner
-
type:
type
object
-
name: string
Catalog item name
-
parentId: string
Catalog parent item identifier (if catalog item has a parent)
400 Response
object
-
code(required): string
Short error code that defines the error, meant for programmatic parsing.
-
message(required): string
Human-readable error string.
401 Response
object
-
code(required): string
Short error code that defines the error, meant for programmatic parsing.
-
message(required): string
Human-readable error string.
403 Response
object
-
code(required): string
Short error code that defines the error, meant for programmatic parsing.
-
message(required): string
Human-readable error string.
404 Response
object
-
code(required): string
Short error code that defines the error, meant for programmatic parsing.
-
message(required): string
Human-readable error string.
500 Response
object
-
code(required): string
Short error code that defines the error, meant for programmatic parsing.
-
message(required): string
Human-readable error string.
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
destId
- Destination path where you want to save the copied object. If specified, none of the other parameters are used.destParentId
andnewItemName
- 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 specifydestParentId
, 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" }