API call description
- In the Developer Backend, go to App Event Subscription and turn on the storage event subscription.
- Call this API to specify the subscription scope as the organization or a specified storage space.
Note
Turning on the storage event subscription switch in the Developer Backend alone is not enough to receive callback events. You must also call this API.Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/events/subscribe |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Permissions required | permission-Storage.Event.Write-Write permission for organization storage file change event subscription |
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 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. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Call the Query user details API to obtain it. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| scopeId | String | Yes | The ID corresponding to the subscription scope. - When the value of the scope parameter is ORG, scopeId corresponds to the organization ID (corpId). See Basic concepts - CorpId. - When scope is SPACE, scopeId corresponds to the storage space ID. Call the Add space API to obtain the id. |
| scope | String | Yes | The subscription scope. - ORG: organization - SPACE: space |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| success | Boolean | Whether the operation succeeded. true indicates success. |
Response body example
Error codes
If an error is returned when you call this API, look up the solution in the Global error codes document based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | paramError | %s | Parameter error |
| 400 | paramError.scope | %s | Parameter error - scope |
| 400 | paramError.scopeId | %s | Parameter error - scopeId |
| 403 | permissionDenied | %s | The user lacks permission to subscribe to the event |
| 500 | systemError | %s | System error |
| 500 | unknownError | Unknown Error | Unknown error |
| 503 | operationTimeout | %s | Request timed out |