tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Renaming or Moving a Directory or Album

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-01-07 14:52:07

Description

Rename or move a directory or album.
Note:
Permission requirements: Non-acl authentication: admin, space_admin or move_directory. For details about permissions, see Generate Access Token API.
This API requires specifying the complete directory path or album name for both source and target. For file type media libraries, the source and target can span multi-level multi-directory to move a directory to any other parent directory, and support simultaneously adjusting the directory name.
Auto-create required intermediate parent directories.

Request

Request Example

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

Request Parameter

Request parameters
Description
Type
Required or Not
LibraryId
Media Library ID, obtain it after creating a media library in the console for media hosting. See Create Media Library
String
Yes
SpaceId
Space ID
If the media library is in single-tenant mode, this parameter is fixed as a hyphen (-).
If the media library is in multi-tenant mode, this parameter is the space ID returned by the Create Tenant Space API.
String
Yes
DirPath
path of the target directory or album name
String
Yes
ConflictResolutionStrategy
Handling method when conflicts occur in the last-level directory, default is ask:
ask: returns HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code when conflicts with.
rename the last level directory if conflicts with
String
No
AccessToken
Access token, please refer to generate access token
String
Yes
UserId
Recognition of user identity, when the access token has admin privileges and the recognition of user identity during token application is empty, is used to temporarily specify 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 renamed or moved.
Request body example:
{
"from": "foo/bar_old"
}
Description of the request body field:
Request parameters
Description
Type
Required or Not
from
renamed or moved source directory or album path
String
Yes

Response

Response code

Rename or move succeeded, return HTTP 204 No Content (ConflictResolutionStrategy is ask) or HTTP 200 OK (ConflictResolutionStrategy is rename).

Response Body

Empty, no response body (ConflictResolutionStrategy is ask) or application/json (ConflictResolutionStrategy is rename).
Response body example:
{ "path": [ "foo", "bar_new (1)" ] }
Description of the response body field:
Response Parameters
Description
Type
path
The final directory or album path, which may differ from the path specified during moving/renaming due to potential automatic renaming.
Array

Error Codes

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

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백