b2_get_bucket_notification_rules
    • Dark
      Light

    b2_get_bucket_notification_rules

    • Dark
      Light

    Article Summary

    Get
    /b2api/v3/b2_get_bucket_notification_rules

    Lists bucket event notification rules alphabetically by rule name

    This will return an error if called on a non-existent bucketId.

    Header parameters
    Authorization
    stringRequired

    An account authorization token, obtained from b2_authorize_account.

    The token must have the readBucketNotifications capability.

    Query parameters
    bucketId
    stringRequired

    The unique identifier for the bucket containing the event notification rules.

    Responses
    200

    The request succeeded.

    Bucket Notification Rules Response
    [
      {
        "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"
            }
          }
        ]
      }
    ]
    Expand All
    object
    bucketId
    string

    The unique identifier for the bucket containing the event notification rules.

    Exampleaea8c5bc362ae55070130333
    eventNotificationRules
    Array of object

    An array of Event Notification Rules.

    Example[ { "eventTypes": [ "b2:ObjectCreated:Upload", "b2:ObjectCreated:MultipartUpload" ], "isEnabled": true, "isSuspended": false, "name": "mySampleRule1", "objectNamePrefix": "", "suspensionReason": "", "targetConfiguration": { "customHeaders": [ { "name": "myCustomHeader1", "value": "myCustomHeaderVal1" }, { "name": "myCustomHeader2", "value": "myCustomHeaderVal2" } ], "hmacSha256SigningSecret": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0", "targetType": "webhook", "url": "https://www.example.com/sampleurl" } } ]
    object
    eventTypes
    Array of string

    The list of event types for the event notification rule.

    Example[ "b2:ObjectCreated:*" ]
    string
    isEnabled
    boolean

    Whether the event notification rule is enabled.

    ExampleTrue
    isSuspended
    boolean

    Whether the event notification rule is suspended.

    ExampleTrue
    name
    string

    A name for the event notification rule. The name must be unique among the bucket's notification rules.

    ExamplemySampleRule1
    objectNamePrefix
    string

    Specifies which object(s) in the bucket the event notification rule applies to.

    Exampleimages/
    suspensionReason
    string

    A brief description of why the event notification rule was suspended.

    ExampleA reason for suspension
    targetConfiguration
    object

    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.

    Example{ "customHeaders": [ { "name": "myCustomHeader1", "value": "myCustomHeaderVal1" }, { "name": "myCustomHeader2", "value": "myCustomHeaderVal2" } ], "hmacSha256SigningSecret": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0", "targetType": "webhook", "url": "https://www.example.com/sampleurl" }
    customHeaders
    Array of object

    When present, additional header name/value pairs to be sent on the webhook invocation.

    Example[ { "name": "myCustomHeader1", "value": "myCustomHeaderVal1" } ]
    object
    name
    string

    The name of the header.

    Examplemy-custom-header-name
    value
    string

    The value of the header

    Examplemy-custom-header-value
    hmacSha256SigningSecret
    string

    The signing secret for use in verifying the X-Bz-Event-Notification-Signature.

    ExampleMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
    targetType
    string

    The type of the target configuration, currently “webhook” only.

    Examplewebhook
    url
    string

    The URL for the webhook.

    Examplehttps://www.example.com
    400
    statuscodedescription
    400bad_bucket_idbucketId is not valid.
    object
    status
    integer

    The numeric HTTP status code. Always matches the status in the HTTP response.

    Example400
    code
    string

    A single-identifier code that identifies the error.

    Exampleinvalid_bucket_name
    message
    string

    A human-readable message, in English, saying what went wrong.

    Examplebucket name is too long
    401
    statuscodedescription
    401bad_auth_tokenThe auth token used is not valid. Call b2_authorize_account again to either get a new one, or an error message describing the problem.
    401expired_auth_tokenThe auth token used has expired. Call b2_authorize_account again to get a new one.
    401unauthorizedThe 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.
    403
    statuscodedescription
    403transaction_cap_exceededTransaction 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.

    Was this article helpful?