API call description
About storage spaces
- A storage space is part of your organization’s cloud drive, but spaces created through this API are not visible on the client-side cloud drive.
- A storage space consumes the capacity of your organization’s cloud drive.
Storage space types
- User space (USER): Files in this space can only be granted permanent permissions, and the grantor must hold management permissions to grant access.
- App space (APP): Files in this space can only be granted temporary permissions, and the grantor is not required to hold management permissions.
Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-Storage.Space.Write-Organization storage space write permission |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it as follows: - For internal apps, call the Obtain the access token of an internal app API. - For third-party enterprise apps, call the Obtain the access token of the authorized enterprise API. |
Query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Obtain it by calling the Query user details API. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| option | Object | No | Optional parameters. |
| name | String | No | The space name. No name is set by default. |
| quota | Long | No | The maximum capacity of the space, in bytes. If this parameter is not specified, the space has no specific capacity limit, but it cannot exceed the total capacity of your organization’s cloud drive. |
| capabilities | Object | No | The capability options of the space. By default, no extended capabilities are set. |
| canSearch | Boolean | No | Whether search is supported. - true: Supported. - false: Not supported. This is the default value. |
| canRename | Boolean | No | Whether renaming the space is supported. - true: Supported. - false: Not supported. This is the default value. |
| canRecordRecentFile | Boolean | No | Whether the space can be included in the Recently Used list. - true: Supported. - false: Not supported. This is the default value. |
| scene | String | No | The space scene. This value is defined by the developer. - If this parameter is not specified, the default value is default. - If the combination of this parameter and sceneId already exists, this API returns the previously created space and does not create a new one. |
| sceneId | String | No | The space scene ID. This value is defined by the developer. - If this parameter is not specified, the default value is 0. - If the combination of sceneId and this parameter already exists, this API returns the previously created space and does not create a new one. |
| ownerType | String | No | The owner type. - USER: User type. This is the default value. - APP: App type. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| space | Object | The space information. |
| id | String | The space ID. |
| corpId | String | The organization ID where the space resides. |
| creatorId | String | The unionId of the creator. |
| ownerType | String | The owner type. - USER: User type. This is the default value. - APP: App type. |
| ownerId | String | The owner identifier. |
| modifierId | String | The unionId of the last modifier. |
| usedQuota | Long | The used capacity, in bytes. |
| quota | Long | The total capacity, in bytes. |
| status | String | The space status. - NORMAL: Normal. - DELETE: Trash. |
| createTime | String | The created time in ISO 8601 format. For example, 2022-07-29T14:55Z. |
| modifiedTime | String | The modified time in ISO 8601 format. For example, 2022-07-29T14:55Z. |
| appId | String | The appId on the Open Platform. |
| scene | String | The business scene. |
| sceneId | String | The space scene ID. |
| capabilities | Object | The capability options of the space. |
| canSearch | Boolean | Whether search is supported. - true: Supported. - false: Not supported. This is the default value. |
| canRename | Boolean | Whether renaming the space is supported. - true: Supported. - false: Not supported. This is the default value. |
| canRecordRecentFile | Boolean | Whether the space can be included in the Recently Used list. - true: Supported. - false: Not supported. This is the default value. |
| name | String | The space name. |
| partitions | Array | The partition capacity information. The maximum value is 2. |
| partitionType | String | The partition type. - PUBLIC_OSS_PARTITION: Public cloud OSS storage partition. - MINI_OSS_PARTITION: Dedicated Mini OSS storage partition. |
| quota | Object | The capacity information. |
| used | Long | The actual used capacity, in bytes. The minimum value is 0. This represents the total capacity occupied by all files under the app. File upload, copy, and delete operations update the value of used accordingly. |
| max | Long | The maximum capacity, in bytes. - When the current app capacity is set to max, the app has an upper capacity limit, and the value of used cannot exceed the value of max. - When the current app capacity is not set to max, this field returns empty, and the app shares the remaining available capacity of the organization. |
| reserved | Long | The remaining pre-allocated capacity, in bytes. The admin console can pre-allocate capacity to an app or space. This field indicates the remaining pre-allocated capacity, that is, the unused portion of the pre-allocated capacity. If no pre-allocated capacity is set, this field is empty. |
| type | String | The capacity type. - SHARE: Shared capacity. In this mode, Quota.max is empty, indicating that the app shares the organization’s capacity. - PRIVATE: Pre-allocated capacity (dedicated capacity). In this mode, after Quota.max is set, the capacity is exclusive. Use pre-allocated (dedicated) capacity when you need to ensure that the available capacity of a single app is not affected by other apps. |
Response body example
Error codes
If an error occurs when you call this API, look up the solution in the Global error codes documentation based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | paramError | %s | Parameter error. |
| 400 | paramError.name | %s | Parameter error - name. |
| 400 | paramError.scene | %s | Parameter error - scene. |
| 400 | paramError.sceneId | %s | Parameter error - sceneId. |
| 403 | permissionDenied | %s | The user lacks permission to create a space. |
| 500 | systemError | %s | System error. |
| 500 | unknownError | Unknown Error | Unknown error. |
| 503 | operationTimeout | %s | Request timed out. |