- Print
- DarkLight
b2_set_bucket_notification_rules
- Print
- DarkLight
Modifies bucket event notification rules
Replace the event notification rules of an existing bucket.
An account authorization token, obtained from b2_authorize_account.
The token must have the writeBucketNotifications
capability.
[
{
"bucketId": "aea8c5bc362ae55070130333",
"eventNotificationRules": [
{
"eventTypes": [
"b2:ObjectCreated:Upload",
"b2:ObjectCreated:MultipartUpload"
],
"isEnabled": true,
"name": "mySampleRule1",
"objectNamePrefix": "",
"targetConfiguration": {
"customHeaders": [
{
"name": "X-My-Custom-Header-1",
"value": "myCustomHeaderVal1"
},
{
"name": "X-My-Custom-Header-2",
"value": "myCustomHeaderVal2"
}
],
"hmacSha256SigningSecret": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0",
"targetType": "webhook",
"url": "https://www.example.com/sampleurl"
}
}
]
}
]
The unique identifier for the bucket containing the event notification rules.
An array containing event notification rules.
The event notification rules in this array replace the bucket’s existing rules.
The list of event types for the event notification rule.
Whether the event notification rule is enabled.
Whether the event notification rule is suspended. This is ignored by b2_set_bucket_notification_rules.
Represents the maximum number of events a user will receive per webhook invocation. The value must be a number between 1 and 50. The default value is 1.
A name for the event notification rule. The name must be unique among the bucket's notification rules.
Specifies which object(s) in the bucket the event notification rule applies to. The objectNamePrefix
must not overlap with another objectNamePrefix
for the same event type.
For example, an event notification rule with the prefix "images/pets/" is not allowed if there is another notification rule in the list of the same event type with "images/".
A brief description of why the event notification rule was suspended. This is ignored by b2_set_bucket_notification_rules.
The target configuration for the event notification rule.
This object will always contain the targetType
field. Currently, the only valid value for targetType
is "webhook."
The fields for "webhook" objects are defined below. However, other targetType
values and collections of fields will be available in the future.
When present, additional header name/value pairs to be sent on the webhook invocation. There can be at most 10 custom header name/value pairs.
The total number of URL-encoded bytes must not exceed 2,048. Each custom header name/value pair will have three extra bytes added to the total, accounting for the :
, \r
, and \n
characters. You may not use a custom header name that begins with X-Bz-
.
The name of the header.
The value of the header
If non-null, this is used to sign the webhook's contents. The value for this field must be a 32-character alphanumeric string.
The type of the target configuration, currently "webhook" only.
The URL for the webhook. The URL must include the HTTPS protocol and must not point to a Backblaze hostname or IP address.
The request succeeded.
[
{
"bucketId": "aea8c5bc362ae55070130333",
"eventNotificationRules": [
{
"eventTypes": [
"b2:ObjectCreated:Upload",
"b2:ObjectCreated:MultipartUpload"
],
"isEnabled": true,
"isSuspended": false,
"name": "mySampleRule1",
"objectNamePrefix": "",
"suspensionReason": "",
"targetConfiguration": {
"customHeaders": [
{
"name": "X-My-Custom-Header-1",
"value": "myCustomHeaderVal1"
},
{
"name": "X-My-Custom-Header-2",
"value": "myCustomHeaderVal2"
}
],
"hmacSha256SigningSecret": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0",
"targetType": "webhook",
"url": "https://www.example.com/sampleurl"
}
}
]
}
]
The unique identifier for the bucket containing the event notification rules.
An array of Event Notification Rules.
The list of event types for the event notification rule.
Whether the event notification rule is enabled.
Whether the event notification rule is suspended.
Represents the maximum number of events a user will receive per webhook invocation. The value must be a number between 1 and 50. The default value is 1.
A name for the event notification rule. The name must be unique among the bucket's notification rules.
Specifies which object(s) in the bucket the event notification rule applies to.
A brief description of why the event notification rule was suspended.
The target configuration for the event notification rule.
This object will always contain the targetType
field. Currently, the only valid value for targetType
is "webhook."
The fields for "webhook" objects are defined below. However, other targetType
values and collections of fields will be available in the future.
When present, additional header name/value pairs to be sent on the webhook invocation.
The name of the header.
The value of the header
The signing secret for use in verifying the X-Bz-Event-Notification-Signature
.
The type of the target configuration, currently "webhook" only.
The URL for the webhook.
status | code | description |
---|---|---|
400 | bad_request | bucketId is not valid. |
400 | cannot_edit_suspended_rule | Suspended rules cannot be edited, only deleted. |
400 | custom_header_name_conflict | There must not be more than one custom header in an event notification rule with the same header name. |
400 | custom_header_name_disallowed | The custom header name supplied is not allowed. |
400 | custom_header_name_empty | Each custom header name must be a non-empty String. |
400 | custom_header_name_invalid | A custom header name is invalid. |
400 | custom_header_size_invalid | The total size of URL encoded custom header name/value bytes must not exceed 2,048. |
400 | custom_header_value_invalid | A custom header value is invalid. |
400 | event_type_categories | An event notification rule has event types from multiple categories. |
400 | event_type_invalid | An event type is invalid. |
400 | event_type_overlap | An event notification rule has overlap in the event types. |
400 | event_types_empty | An event notification rule has overlap in the event types. |
400 | prefix_overlap | More than one event notification rule has overlap in the objectNamePrefix for the same event type. |
400 | signing_secret_invalid | The signing secret provided is not allowed. |
400 | rule_name_invalid | An event notification rule has an invalid rule name. |
400 | target_url_domain_invalid | There must not be a webhook URL that points to a Backblaze domain. |
400 | target_url_invalid | The target URL for an event notification rule is invalid. |
400 | target_url_protocol_invalid | The target URL for an event notification rule is not using https. |
400 | too_many_custom_headers | An event notification rule has more than 10 custom header name/value pairs. |
400 | too_many_event_notification_rules | There are more than 25 event notification rules defined. |
The numeric HTTP status code. Always matches the status in the HTTP response.
A single-identifier code that identifies the error.
A human-readable message, in English, saying what went wrong.
status | code | description |
---|---|---|
401 | bad_auth_token | The auth token used is not valid. Call b2_authorize_account again to either get a new one, or an error message describing the problem. |
401 | expired_auth_token | The auth token used has expired. Call b2_authorize_account again to get a new one. |
401 | unauthorized | The auth token used is valid, but does not authorize this call with these parameters. The capabilities of an auth token are determined by the application key used with b2_authorize_account. |
status | code | description |
---|---|---|
403 | transaction_cap_exceeded | Transaction cap exceeded. To increase your cap, sign in to your B2 Cloud Storage account online. Then select the Caps & Alerts link in the B2 Cloud Storage section of the sidebar. |