Setting Up Bucket Notification Rules
Updated at:2025-11-03
API description
This API sets notification rules for a specified bucket.
Note:
- Only the bucket owner or users with FULL_CONTROL permission can access this bucket's configuration.
- A 403 status will be returned if the requester is not the bucket owner, or a 404 status if the specified file does not exist.
Request URI
PUT /v1/{bucketName}/?notification
| Parameter name | Parameter type | Required or not | Description | Example value | Parameter location |
|---|---|---|---|---|---|
| bucketName | String | Yes | Bucket name | "bucketName_example" | Path |
Parameters of request body
Description of the data structure of request body fields
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| notifications | List |
No |
Description of the data structure of the Notifications field
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| id | String | Yes | Rule ID | notify-id-1 |
| name | String | No | Rule name | rule-name |
| appId | String | Yes | Product ID for registering this rule | app-id-1 |
| status | String | Yes | Options: {"disabled", "enabled"} | enabled |
| encryption | Encryption | No | Encryption method | |
| resources | List |
Yes | Subscribed resources, such as ${bucketname}/path1/.jpg or /path1/_.jpg, with a maximum of 1* | |
| events | List |
Yes | Subscribed events | |
| apps | List |
Yes | The product subscribed to for messages |
Description of the data structure of the Encryption field
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| key | String | No | Encryption key. If it is not empty, the IAM algorithm is used to sign the notification request, where the key corresponds to the SecretAccessKey in the IAM signature. | 06a62b70f47dc4a0a7da349609f1a1ac |
Description of the data structure of the Apps field
| Parameter name | Parameter type | Required or not | Description | Example value |
|---|---|---|---|---|
| id | String | No | Product ID to be notified | app-id-3 |
| eventUrl | String | No | URL for processing event notification. Options: {"http", "https", "brn", "app"}. http/https are for custom applications, brn for CFC notifications, and app for official applications. | app:ImageOcr |
| xVars | String | No | Custom parameters passed through. They are transparent to the framework, used for self-return values of the service. For official AI applications, this is a stringified JSON containing a saveUrl address to receive processing results. | {"saveUrl": "http://xxx.com/ocr\"} |
Response body parameters
Description of the data structure of response body fields
Request example
JSON
1PUT /v1/bucketName_example/?notification
2 <Common request headers>
3{
4 "notifications" : [ {
5 "encryption" : {
6 "key" : "06a62b70f47dc4a0a7da349609f1a1ac"
7 },
8 "appId" : "app-id-1",
9 "name" : "rule-name",
10 "resources" : [ "bucket-a/path1" ],
11 "id" : "notify-id-1",
12 "events" : [ "PutObject" ],
13 "status" : "enabled",
14 "apps" : [ {
15 "eventUrl" : "app:ImageOcr",
16 "xVars" : "{\"saveUrl\": \"http://xxx.com/ocr\"}",
17 "id" : "app-id-3"
18 } ]
19 } ]
20}
Response example
JSON
1HTTP/1.1 200 OK
2 <Common response headers>
3{ }
Error code
Please refer to the general error codes
