Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/{dentryId}/rename |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-Storage.File.Write-Organization storage file write permission |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential used to call this API. Obtain it as follows: - For an internal app, call the Get the access token of an internal app API. - For a third-party enterprise app, call the Get the access token of the authorized organization for a third-party app API. |
Path parameter
| Name | Type | Required | Description |
|---|---|---|---|
| spaceId | String | Yes | The space ID. Call the Add a space API to obtain the value of the id parameter. |
| dentryId | String | Yes | The file or folder ID. Call the Get the list of files or folders or Get spaceId and dentryId by dentryUuid API to obtain the value of the id parameter. The root directory of a storage space cannot be renamed, so this parameter does not support the value 0. |
Query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Call the Query user details API to obtain the value of the unionid parameter. |
Request body
| Name | Type | Required | Description | |
|---|---|---|---|---|
| newName | String | Yes | The new name of the file or folder. Naming rules:- Leading and trailing spaces are automatically removed. - Cannot contain special characters, including: tab, *, ", <, >, ` | . - Cannot end with .`. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| dentry | Object | The list of file or folder information. |
| id | String | The file or folder ID. |
| spaceId | String | The ID of the space that the file or folder belongs to. |
| parentId | String | The parent directory ID. For the root directory, this parameter is 0. |
| type | String | The type: - FILE: file - FOLDER: folder |
| name | String | The name after renaming. |
| size | Long | The file size, in bytes. This field is not returned for folders. |
| path | String | The path of the file or folder. |
| version | Long | The version. |
| status | String | The status: - NORMAL: normal - DELETED: deleted - EXPIRED: expired |
| extension | String | The file extension. This field is not returned for folders. |
| creatorId | String | The unionId of the creator. |
| modifierId | String | The unionId of the modifier. |
| createTime | String | The created time, in ISO 8601 format. Example: 2022-07-29T14:55Z. |
| modifiedTime | String | The modified time, in ISO 8601 format. Example: 2022-07-29T14:55Z. |
| properties | Object | The attributes. |
| readOnly | Boolean | Whether the file or folder is read-only: - true: yes - false: no |
| appProperties | Map<String, Array> | The attributes specific to an app. |
| Array | The list of attributes. | |
| name | String | The attribute name. |
| value | String | The attribute value. |
| visibility | String | The attribute visibility: - PUBLIC: visible to all spaces - PTIVATE: visible only to the current space |
| uuid | String | The identifier field. |
| partitionType | String | The storage partition: - PUBLIC_OSS_PARTITION: public cloud OSS storage partition - MINI_OSS_PARTITION: dedicated MiniOSS storage partition |
| storageDriver | String | The driver type: - DINGTALK: DingTalk unified storage driver - ALIDOC: DingTalk Docs storage driver - UNKNOWN: unknown driver |
Response body example
Error codes
If the API call fails, refer to the error message and look up the solution in the Global error codes document.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | operationConcurrentControl | %s | Concurrency control |
| 400 | paramError | %s | Parameter error |
| 400 | paramError.spaceId | %s | Parameter error - spaceId |
| 400 | paramError.dentryId | %s | Parameter error - dentryId |
| 400 | paramError.name | %s | Parameter error - name |
| 400 | dentryAlreadyExist | %s | A file with the same name already exists |
| 403 | permissionDenied | %s | The user lacks permission to rename the file or folder |
| 404 | spaceNotExist | %s | The space does not exist |
| 404 | dentryNotExist | %s | The file does not exist |
| 500 | systemError | %s | System error |
| 500 | unknownError | Unknown Error | Unknown error |
| 503 | operationTimeout | %s | Request timed out |