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

Directory or Album

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 10:49:13

Introduction

This document provides API introduction related to directory or album and example code.

List Directory or Album Content

Feature Description

List directory or album content.

Sample Code

try {
let result = await SMHDirectoryApis.listDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath:'dir',
limit:'10',
orderBy:SMHFileListOrderBy.name,
orderByType:SMHOrderByType.asc,
withFavoriteStatus:true,
withInode:true
});
}catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directory, use a slash (/) to separate, such as foo/bar. For root directory, leave this parameter blank.
String
No
marker
Identification for sequential list pagination cannot be used with page and page_size parameters simultaneously
String
No
limit
Limit for locally listed items in sequential pagination cannot be used with page and page_size parameters simultaneously
String
No
page
pagination code, default first page, optional parameter, cannot be used with marker and limit parameters simultaneously
Number
No
pageSize
page size, default 20, optional parameter, cannot be used with marker and limit parameters simultaneously
Number
No
orderBy
sorting field, sort by name as name, sort by modification time as modificationTime, sort by file size as size, sort by creation time as creationTime
SMHFileListOrderBy
No
orderByType
sorting method, ascending as asc, descending as desc
SMHOrderByType
No
directoryFilter
Filtering method, return all if not specified, onlyDir for folders only, onlyFile for files only
SMHDirectoryFilter
No
sortType
Sorting method. If not specified, files and folders are sorted separately, with folders returned first followed by files. union sorts files and folders together.
String
No
withFavoriteStatus
Whether to return favorite status
Bool
No
withInode
Whether to return inode, the file directory ID
Bool
No

Creating a Directory or Album

Feature Description

To create a directory or album.

Sample Code

try{
let result = await SMHDirectoryApis.createDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath: "dir",
conflictResolutionStrategy: SMHConflictResolutionStrategy.rename,
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directory, use a slash (/) to separate, such as foo/bar. For root directory, leave this parameter blank.
String
Yes
conflictResolutionStrategy
Handling method when last-level directory conflicts
Returns HTTP 409 Conflict and SameNameDirectoryOrFileExists error code when conflicts with
rename the last level directory if conflicts with
ask by default
SMHConflictResolutionStrategy
No
withInode
Whether to return inode, the file directory ID
Bool
No

Delete Directory or Album

Feature Description

To delete a directory or album.

Sample Code

try{
let result = await SMHDirectoryApis.deleteDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath:'path'
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
permanent
When the media library enables the Recycle Bin, this parameter specifies whether to move the file to the Recycle Bin or permanently delete it. true: permanently delete, false: move to Recycle Bin, default to false.
Bool
No

Copying a Directory or Album

Feature Description

To copy a directory or album.

Sample Code

try {
let result = await SMHDirectoryApis.copyDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath: "path",
copyFrom: "from"
})
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
copyFrom
Source directory or album path to be copied
String
Yes
conflictResolutionStrategy
Handling method when last-level directory conflicts
Returns HTTP 409 Conflict and SameNameDirectoryOrFileExists error code when conflicts with
rename the last level directory if conflicts with
ask by default
SMHConflictResolutionStrategy
No

Renaming/Moving a Directory or Album

Feature Description

To rename or move a directory or album.

Sample Code

try {
let result = await SMHDirectoryApis.moveDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath: "path",
from: "from"
})
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
from
Source directory or album path to be renamed or moved
String
Yes
conflictResolutionStrategy
Handling method when last-level directory conflicts
Returns HTTP 409 Conflict and SameNameDirectoryOrFileExists error code when conflicts with
rename the last level directory if conflicts with
ask by default
SMHConflictResolutionStrategy
No

Updating Directory Tag

Feature Description

Update directory tags.

Sample Code

try{
let result = await SMHDirectoryApis.updateLabels({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath:"path",
labels:["18","age"]
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
labels
File Tag List
String array
No

Getting Additional Information for Files/Directories

Feature Description

Get additional information for files/directories.

Sample Code

try {
let result = await SMHDirectoryApis.additionalInfo({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath: "test",
objectsKeys: ["key1"]
})
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory or file path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
objectsKeys
Each element should be the name of a file or directory under DirPath.
String array
Yes

Viewing Directory or Album Details

Feature Description

View directory or album details.

Sample Code

try{
let result = await SMHDirectoryApis.directoryDetail({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath:"path",
withInode:true,
withFavoriteStatus:true
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes
withInode
Whether to return inode, the file directory ID
Bool
No

Checking Directory or Album Status

Feature Description

Check directory or album status.

Sample Code

try{
let result = await SMHDirectoryApis.headDirectory({
libraryId:"libraryId",
spaceId:"spaceId",
dirPath:"path"
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
Directory path or album name. For multi-level directories, use a slash (/) to separate, such as foo/bar.
String
Yes

Getting Album Cover

Feature Description

To obtain the album cover.

Sample Code

try{
let result = await SMHDirectoryApis.getAlbumCoverUrl({
libraryId:"libraryId",
spaceId:"spaceId",
albumName:"albumName",
size:"100"
});
}catch(e){
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtained after creating a media library through 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
albumName
Album name. This parameter must be specified for an album-based media library and cannot be specified for a non-album media library.
String
No
size
Scale size. If this parameter is specified, prioritize intelligent face recognition zoom cropping to {Size}px × {Size}px. If no human face is detected, use centered zoom cropping to {Size}px × {Size}px. If the {Size} parameter is not specified, use the original image.
String
No

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック