tencent cloud

Smart Media Hosting

Copy Directory or Album

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 14:52:07

Description

Copy directories or albums.
Note:
Required permissions: admin, space_admin, or copy_directory. For permission details, refer to generate access token interface.
Automatically create the required intermediate parent directories at all levels.

Request

Request Example

PUT /api/v1/directory/{LibraryId}/{SpaceId}/{DirPath}?conflict_resolution_strategy={ConflictResolutionStrategy}&access_token={AccessToken}&user_id={UserId}

Request Parameter

Request parameters.
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library in the Media Hosting console. See Create Media Library.
String
Yes
SpaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. See create tenant space.
String
No
DirPath
Target directory path or album name.
For multi-level directories, use a slash (/) to separate, such as foo/bar_new
String
Yes
ConflictResolutionStrategy
Handling method when last-level directory conflicts, default is ask:
HTTP 409 Conflict and SameNameDirectoryOrFileExists error code returned when conflicts with
rename the last level directory if conflicts with
String
No
AccessToken
Access token, see Generate access token
String
Yes
UserId
User identity recognition. When the permission corresponding to the access token is admin permission and the user identity recognition when applying for the access token is empty, it is used to temporarily designate the user identity. For details, see Generate Access Token API.
String
No

Request Body

application/json, specify the source directory path or album name to be copied.
Request body example:
{
"copyFrom": "foo/bar"
}
Request body field description:
Request parameters.
Description
Type
Required or Not
copyFrom
The source directory or album path to be copied
String
Yes

Response

Response code

Copied successfully, return HTTP 202 Accepted.

Response Body

Empty, no response body (return HTTP 204 No Content) or application/json (return HTTP 200 OK or HTTP 202 Accepted).
Response body example:
Returns HTTP 200 OK:
{ "path": [ "foo", "bar (1)" ] }
Returns HTTP 202 Accepted:
{ "taskId": 10 }
[
{
"id": 10,
"status": 200,
"result": { "path": [ "foo", "bar (1)" ] }
}
]
Response body field description:
Response Parameters
Description
Type
path
Indicates the final directory or album path. Since automatic renaming may exist, the final path here may not equal the path specified when copying the directory or album.
Array
taskId
The task ID for asynchronous copying can be used to query task status via the Query Task API.
String

Error Codes

This request operation has no special error messages. For common error messages, see Error Codes.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan