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

Torch Object Storage

Copy page
Download PDF
Event Notification
GetBucketNotificationV2
Copy page
Download PDF
GetBucketNotificationV2
Feature description​
This API retrieves the event notification rules set for a specified bucket.​
Notes​
  • You must be the bucket owner or have the GetBucketNotification permission authorized for the current bucket to call this API.​
  • HNS buckets do not currently support the GetBucketNotificationV2 API.​
Request syntax​
​
GET /?notification_v2 HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: GMT Date​
Authorization: authorization string​
​
Request parameters and headers​
​
Name​
Location​
Parameter type​
Required​
Sample value​
Note​
notification_v2​
Query​
String​
Yes​
-​
Special identifier representing the GetBucketNotificationV2 request.​
​
Request elements ​
This request has no message elements.​
Response headers​
This request returns common response headers. See common parameters.​
Response body elements​
​
Name​
Type​
Sample value​
Note​
Rules​
Array​
-​
Event notification rule information.​
Events​
Array​
["tos:ObjectCreated:", "tos:ObjectRemoved:"]​
Event type. For a list of types supported by TOS, see Supported event types.​
Parent node: Rules​
Filter​
Container​
-​
Filter rules.​
Parent node: Rules​
TOSKey​
Container​
-​
Filter information for the object.​
Parent node: Filter​
FilterRules​
Array​
[​
{"Name": "prefix",​
"Value": "test_"​
},​
{​
"Name": "suffix",​
"Value": ".jpg" }​
]​
Filter rules that objects must match. Supports setting prefix and suffix, which filter event objects based on prefix and suffix rules respectively.​
  • If both prefix and suffix rules are set, the event must meet 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​
prefix​
Matching condition. The fields are described as follows:​
  • prefix: prefix.​
  • suffix: suffix.​
Parent node: FilterRules​
Value​
String​
test_​
Matching prefix and suffix information.​
Parent node: FilterRules​
RuleId​
String​
TestNotification​
Event notification rule name must follow this convention:​
  • Event names must be unique within the bucket.​
  • Length must not exceed 255 characters.​
If not set, TOS will automatically generate a rule name.​
Parent node: Rules​
Destination​
Container​
-​
Event notification push targets must include at least one target and support up to five different targets.​
Parent node: Rules​
ServiceManaged ​
Boolean​
true​
The default value is true, indicating that the rule is a managed rule.​
Parent node: Rules​
ServiceManagedBy ​
String​
ServiceCode​
The hosting provider's Service Code identifies the management service to which this rule belongs.​
Parent node: Rules​
VeFaaS​
Array​
[​
{"FunctionId": "l2u0****"}​
]​
The event delivery target is the function service.​
Parent node: Destination​
FunctionId​
String​
l2u0****​
The function ID for event delivery. You can log in to the Function Service Console and check the Function ID on the Configuration page of the function.​
Parent node: VeFaaS​
Kafka​
Array​
"Kafka":[​
{​
"Role":"trn:iam::214748****:role/aaa",​
"InstanceId":"kafka-cnoeb1pq83rs****",​
"Topic":"test-aaa",​
"User":"bbbbb"​
}​
]​
The event delivery target is the Kafka version of the message queue.​
Parent node: Destination​
Role​
String​
trn:iam::214748****:role/aaa​
Role TRN for authorizing TOS to access Kafka services.​
Parent node: Kafka​
InstanceId​
String​
kafka-cnoeb1pq83rs****​
Kafka instance ID.​
Parent node: Kafka​
Topic​
String​
test-aaa​
Name of the Kafka topic.​
Parent node: Kafka​
User​
String​
bbb​
Kafka user name.​
Parent node: Kafka​
Version​
String​
1698031811529301000​
Version number of the event notification rule.​
Same level as Rules.​
​
Sample request​
​
GET /?notification_v2= HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Fri, 30 Jul 2021 13:53:55 +0000​
Authorization: authorization string​
​
Sample response​
  • The event notification target is the function service​
  • ​
    HTTP/1.1 200 OK​
    Content-Length: 259​
    Content-Type: application/json​
    Date: Wed, 17 May 2023 12:18:08 GMT​
    Server: TosServer​
    X-Tos-Id-2: b2cb0164c600cacd6464c600-ac1023d1-1pzG6a-GBN-cgb-tos​
    X-Tos-Request-Id: b2cb0164c600cacd6464c600-ac1023d1-1pzG6a-GBN-cgb-tos​
    X-Tos-Server-Time: 7​
    {​
    "Rules":[​
    {​
    "Events":[​
    "tos:ObjectCreated:*",​
    "tos:ObjectRemoved:*"​
    ],​
    "Filter":{​
    "TOSKey":{​
    "FilterRules":[​
    {​
    "Name":"prefix",​
    "Value":"test_"​
    },​
    {​
    "Name":"suffix",​
    "Value":".jpg"​
    }​
    ]​
    }​
    },​
    "RuleId":"TestNotification",​
    "Destination":{​
    "VeFaaS":[​
    {​
    "FunctionId":"l2u0****"​
    }​
    ]​
    },​
    "ServiceManaged": true,​
    "ServiceManagedBy": "ServiceCode"​
    }​
    ],​
    "Version": "1698031811529301000"​
    }​
    ​
  • The event notification target is the Kafka version of the message queue​
  • ​
    HTTP/1.1 200 OK​
    Content-Length: 414​
    Content-Type: application/json​
    Date: Wed, 17 May 2023 12:18:08 GMT​
    Server: TosServer​
    X-Tos-Id-2: b2cb0164c600cacd6464c600-ac1023d1-1pzG6a-GBN-cgb-tos​
    X-Tos-Request-Id: b2cb0164c600cacd6464c600-ac1023d1-1pzG6a-GBN-cgb-tos​
    X-Tos-Server-Time: 7​
    {​
    "Rules": [​
    {​
    "Events": [​
    "tos:ObjectCreated:*",​
    "tos:ObjectRemoved:*"​
    ],​
    "Filter": {​
    "TOSKey": {​
    "FilterRules": [​
    {​
    "Name": "prefix",​
    "Value": "test_"​
    },​
    {​
    "Name": "suffix",​
    "Value": ".jpg"​
    }​
    ]​
    }​
    },​
    "RuleId": "event",​
    "Destination": {​
    "Kafka": [​
    {​
    "Role": "trn:iam::214748****:role/aaa",​
    "InstanceId": "kafka-cnoeb1pq83rs****",​
    "Topic": "test-aaa",​
    "User": "bbbbb"​
    }​
    ]​
    },​
    "ServiceManaged": true,​
    "ServiceManagedBy": "ServiceCode"​
    }​
    ],​
    "Version": "1755056218115649299"​
    }​
    ​
​
Last updated: 2026.07.08 16:46:31