PutNotification
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
-
Request syntax
Plain Text1PUT /?notification HTTP/1.1 2Host: <BucketName>.bj.bcebos.com 3Date: <Date> 4Authorization: <AuthorizationString> 5Content-Type: application/json; charset=utf-8 6Content-Length: <ContentLength> -
Request parameters
| Field | Types | Necessity | Description |
|---|---|---|---|
| id | String | Required | Rule ID |
| name | String | Optional | Rule name |
| appId | String | Required | Product ID for registering this rule |
| status | String | Required | Options: {"disabled", "enabled"} |
| encryption | Object | Optional | Encryption method |
| +key | String | Optional | 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. |
| resources[] | Array | Required | Subscribed resources |
| +resource | String | Required | Subscribed resources: ${bucket_name}/path1/*.jpg or /path1/*.jpg, with a maximum of only one * |
| events[] | Array | Required | Subscribed events |
| +eventType | String | Required | Event types supported currently: - PutObject: normal upload of object - PostObject: Form upload of object - AppendObject: Append upload of object - CopyObject: Copy object - CompleteMultipartUpload: Complete multipart upload of object - FetchObject: Fetch object, including fetching generated by image back-to-origin operation - DeleteObject: Delete object - DeleteMultipleObjects: Delete multiple object - "BosLifecycle:Copy": Replication events triggered by lifecycle, including CopyObject requests and the third step of CompleteMultipartUpload requests of multipart replication. - "ObjectCreateGroup:*": All the operations of creating files. - "ObjectModifyGroup:*": All the operations of modifying files, including overwriting files, setting custom meta, changing file storage class, and modifying encryption algorithms. |
| apps[] | Array | Required | The product subscribed to for messages |
| +id | String | Required | Product ID to be notified |
| +eventUrl | String | Required | 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. |
| +xVars | String | Optional | 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. |
If the request is only used for configuring notification or callback keys, its parameters can be simplified as follows:
| Field | Types | Necessity | Description |
|---|---|---|---|
| id | String | Required | Rule ID |
| name | String | Optional | Rule name |
| appId | String | Required | Product ID for registering this rule |
| status | String | Required | Options: {"disabled", "enabled"} |
| encryption | Object | Optional | Encryption method |
| +key | String | Optional | 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. |
Response
Example
-
Request example
Plain Text1PUT /?notification HTTP/1.1 2Host: <BucketName>.bj.bcebos.com 3Date: Wed, 12 Sep 2018 06:34:40 GMT 4Authorization: <AthorizationString> 5Content-Type: application/json; charset=utf-8 6Content-Length: 0 7{ 8 "notifications": [ 9 { 10 "id": "notify-id-1", 11 "name": "rule-name", 12 "appId": "app-id-1", 13 "status": "enabled", 14 "encryption": { 15 "key": "06a62b70f47dc4a0a7da349609f1a1ac", 16 }, 17 "resources": [ 18 "bucket-a/path1", "/path2", "/path3/*.jpg", "/path4/*" 19 ], 20 "events": [ 21 "PutObject" 22 ], 23 "apps": [ 24 { 25 "id": "app-id-1", 26 "eventUrl": "http://xxx.com/event", 27 "xVars": "" 28 }, 29 { 30 "id": "app-id-2", 31 "eventUrl": "brn:bce:cfc:bj:1f1c3e38xxxxxxxx4c44523f0d5b22:function:hello_bos:$LATEST" 32 }, 33 { 34 "id": "app-id-3", 35 "eventUrl": "app:ImageOcr", 36 "xVars": "{\"saveUrl\": \"http://xxx.com/ocr\"}" 37 } 38 ] 39 } 40 ] 41} -
Response example
Plain Text1HTTP/1.1 200 OK 2x-bce-request-id: 4db2b34d-654d-4d8a-b49b-xxxxxx786409 3Date: Wed, 12 Sep 2018 06:34:40 GMT 4Content-Length: 0 5Connection: close 6Server: BceBos
