You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Event Notification
PutBucketNotification
Copy page
Download PDF
PutBucketNotification
Feature description​
This interface sets event notification rules for a bucket. With event notifications, you can receive alerts when resources in the bucket change.​
Notes​
  • You must be the bucket owner or have PutBucketNotification permission for the bucket to call this interface.​
  • It is recommended to use the PutBucketNotificationV2 interface, which supports pushing the same event to multiple targets.​
  • HNS buckets do not support the PutBucketNotification interface.​
Request syntax​
​
PUT /?notification HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: GMT Date​
Authorization: authorization string​
{​
"CloudFunctionConfigurations": [​
{​
"Events": [​
"tos:ObjectCreated:*",​
"tos:ObjectRemoved:*"​
],​
"Filter": {​
"TOSKey": {​
"FilterRules": [​
{​
"Name": "prefix",​
"Value": "test_"​
},​
{​
"Name": "suffix",​
"Value": ".jpg"​
}​
]​
}​
},​
"RuleId": "string",​
"CloudFunction": "string"​
}​
]​
}​
​
Request parameters and headers​
The public response headers returned by this request. See public parameters.​
​
Name​
Location​
Type​
Required​
Sample value​
Note​
notification​
Query​
String​
Yes​
-​
Special identifier representing the PutBucketNotification request.​
​
Request elements​
​
Name​
Type​
Required​
Sample value​
Description​
CloudFunctionConfigurations​
Array​
No​
-​
Event notification rule information.​
Events​
Array​
Yes​
["tos:ObjectCreated:", "tos:ObjectRemoved:"]​
Set the types of events to notify. For a list of types supported by TOS, see Supported event types.​
Parent node: CloudFunctionConfigurations​
Filter​
Container​
No​
-​
Set filter rules.​
Parent node: CloudFunctionConfigurations​
TOSKey​
Container​
No​
-​
Currently supports setting FilterRule, which is the object's filter information.​
Parent node: Filter​
FilterRules​
Array​
No​
[​
{"Name": "prefix",​
"Value": "test_"​
},​
{​
"Name": "suffix",​
"Value": ".jpg" }​
]​
Set the filtering rules that the object must match. Supports setting prefix and suffix, filtering event objects based on prefix and suffix rules respectively.​
  • If both prefix and suffix rules are set, the event must satisfy both to trigger a notification.​
  • If neither a prefix nor a suffix is set, all objects in the bucket will be matched.​
Parent node: TOSKey​
Name​
String​
No​
prefix​
Set the conditions to match. The options are as follows:​
  • prefix: prefix.​
  • suffix: suffix.​
Parent node: FilterRules​
Value​
String​
No​
test_​
Set the prefix and suffix information to be matched.​
Parent node: FilterRules​
RuleId​
String​
No​
TestNotification​
Set the event notification rule name with the following naming conventions:​
  • Event names must be unique within the bucket.​
  • Length must not exceed 255 characters.​
If not set, TOS will generate the rule name automatically.​
Parent node: CloudFunctionConfigurations​
CloudFunction​
String​
Yes​
l2u0****​
Function ID for event delivery. You can log in to the Function Service Console and view the function ID on the function configuration page.​
Parent node: CloudFunctionConfigurations​
​
Response headers​
The public response headers returned by this request. See public parameters.​
Response body elements​
If the request is successful, no message elements appear in the response.​
Sample request​
​
PUT /?notification= HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 13:53:55 +0000​
Authorization: authorization string​
{​
"CloudFunctionConfigurations": [​
{​
"RuleId": "TestNotification",​
"Events": [​
"tos:ObjectCreated:Put"​
],​
"Filter": {​
"TOSKey": {​
"FilterRules": [​
{​
"Name": "prefix",​
"Value": "test-"​
},​
{​
"Name": "suffix",​
"Value": ".jpg"​
}​
]​
}​
},​
"CloudFunction": "l2u0****"​
}​
]​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
Content-Length: 0​
Date: Wed, 17 May 2023 12:18:08 GMT​
Server: TosServer​
X-Tos-Id-2: c25e0164c600b8df6464c600-ac1bb4fd-1pzG6a-PBN-cgb-tos-front-2​
X-Tos-Request-Id: c25e0164c600b8df6464c600-ac1bb4fd-1pzG6a-PBN-cgb-tos-front-2​
X-Tos-Server-Time: 165​
​
​
Last updated: 2025.09.08 17:32:48