Adding a File Directory
Function
Add a file directory.
URI
POST /koodrive/ose/v1/directory
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
language | No | String | Definition: Language code. Constraints: The value must comply with the internationalization specifications. For example, en_us indicates English (United States). Range: N/A Default Value: If this parameter is not transferred, English (United States) is used by default. |
Authorization | Yes | String | Definition: Access token. Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission. Constraints: The format is Bearer+{access_token}. Range: For details about how to obtain an access token, see the corresponding developer guide. Default Value: N/A |
X-Traceid | No | String | Definition: Message log trace ID. The value contains 58 bits. Constraints: N/A Range: N/A Default Value: N/A |
X-User-Id | Yes | String | Definition: User ID on KooDrive, which is used for app authentication. Constraints: N/A Range: N/A Default Value: N/A |
X-Date | Yes | String | Definition: Date, which is used for app authentication. Constraints: The value must be within 15 minutes from the current time and cannot be later than the current time. Range: The format is yyyMMdd'T'HHmmss'Z', for example, 20251103T070140Z. Default Value: N/A |
x-hw-share-folder-id | No | String | Definition: ID of the shared folder. If this request header is passed, the current operation is performed in the shared folder. Constraints: N/A Range: N/A Default Value: N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
createdTime | No | String | Definition: File creation time. Constraints: The format is yyyy-MM-ddTHH:mm:ss.sssZ. Range: N/A Default Value: N/A |
description | No | String | Definition: File description. Constraints: The value contains up to 512 characters and cannot contain invalid characters such as emojis. Range: N/A Default Value: N/A |
mimeType | No | String | Definition: Resource type. Constraints: N/A Range: N/A Default Value: N/A |
editedTime | No | String | Definition: File modification time. Constraints: N/A Range: N/A Default Value: N/A |
fileName | Yes | String | Definition: File name. Constraints: The value cannot contain the following characters: '<>|:"*? /', cannot be '..', '.', '', and can contain up to 250 characters. Range: N/A Default Value: N/A |
fileType | Yes | String | Definition: File type, which is input externally. Constraints: N/A Range: The value is fixed at 10. Default Value: N/A |
parentFolder | No | Array of strings | Definition: List of parent directory IDs. The first directory is used as the parent directory. Constraints: N/A Range: N/A Default Value: If the value is empty, the root directory is created by default. |
containerId | Yes | String | Definition: Space ID. Constraints: N/A Range: N/A Default Value: N/A |
renameMode | No | Integer | Definition: Policy for specifying how to handle duplicate names. Constraints: N/A Range: 2: Forcibly a file with an existing name by adding a timestamp to the end of the file name. 3: Reject files with the same name. A file with an existing name cannot be created. Default Value: N/A |
hidden | No | Boolean | Definition: Whether the directory is hidden. Constraints: Currently, this function is available only to whitelisted users. Range: N/A Default Value: N/A |
smartFolderAttr | No | Array of SmartFolderAttr objects | Definition: Smart folder properties. Constraints: Currently, this function is available only to whitelisted users. Range: 100 Default Value: N/A |
scene | No | String | Definition: Custom property. Constraints: N/A Range: N/A Default Value: N/A |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
name | No | Integer | Definition: Property name. Constraints: N/A Range: N/A Default Value: N/A |
type | No | Integer | Definition: Property type. Constraints: N/A Range: N/A Default Value: N/A |
value | No | String | Definition: Property value. Constraints: N/A Range: N/A Default Value: N/A |
sort | No | Integer | Definition: Sorting value. Constraints: N/A Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
id | String | File ID. |
fileName | String | File name. |
mimeType | String | File format. |
code | String | Response code. |
msg | String | Response information. |
existFileId | String | If the renaming policy is set to deny renaming and there is a file with the same name, the ID of the existing file is returned. |
Example Requests
Creates a folder in the root directory of the space IAADfsBFCO6WtAtuA315074383680425b8aa9a130cba2d4.
POST /koodrive/ose/v1/directory
Authorization:Bearer+10f88*********4791e9ff
{
"createdTime": "",
"editedTime": "",
"description": "222",
"mimeType": "application/vnd.huawei-apps.folder",
"fileName": "ttgg",
"fileType": "10",
"parentFolder": [
"root"
],
"containerId": "IAADfsBFCO6WtAtuA315074383680425b8aa9a130cba2d4",
"renameMode": "2"
} Example Responses
Status code: 200
Information returned after the directory is created.
{
"id" : "FqAHbpps7uJEDpvh2MbpLj7lD4AM2OWMR",
"fileName" : "ttgg",
"mimeType" : "application/vnd.huawei-apps.folder",
"code" : 0,
"msg" : "success"
} Status Codes
Status Code | Description |
|---|---|
200 | Information returned after the directory is created. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
