百度智能云

All Product Document

          Object Storage

          Set Bucket Notification Rule

          Interface Description

          This interface is used to add the notification rules in the specified bucket.

          Notes:

          • Only the bucket owner or the user with the FULL_CONTROL permission can get the configuration of this bucket.
          • If it is not the bucket owner, this interface returns “Error 403”. If the corresponding file does not exist, it returns “Error 404”.

          Request URI

          PUT /v1/{bucketName}/?notification

          Parameter Name Parameter Type Required? Description Example value Parameter Position
          bucketName String Yes Bucket name "bucketName_example" Path

          Request Body Parameters

          Instructions for Data Structure of Request Body Field

          Parameter Name Parameter Type Required Description Example Value
          notifications List No

          Data Structure Description of Notifications Field

          Parameter Name Parameter Type Required Description Example Value
          id String Yes Rule ID notify-id-1
          name String No Rule name rule-name
          appId String Yes Product ID for registering this rule app-id-1
          status String Yes Optional value: {"disabled", "enabled"} enabled
          encryption Encryption No Encryption method
          resources List Yes Subscribed resources ${bucketname}/path1/.jpg or path1/.jpg_, which can only contain one at most.
          events List Yes Subscribed event
          apps List Yes Product that subscribes to the message.

          Data Structure Description of Encryption Field

          Parameter Name Parameter type Required Description Example value
          key String No Encryption key. If it is not empty, the IAM algorithm is used to sign the request for notification, and the key corresponds to SecretAccessKey in the IAM signature. 06a62b70f47dc4a0a7da349609f1a1ac

          Description of Data Structure for Apps Field

          Parameter Name Parameter Type Required Description Example Value
          id String No Notified product ID app-id-3
          eventUrl String No URL for handling event notification, optional value: {"http", "https", "brn", "app"}. Of which, http/https is the custom application, brn is the notification of CFC, and app is the official application. app:ImageOcr
          xVars String No Custom parameter for the transparent transmission, which is transparent to the framework and used for the value passed back by the business itself. If it is an official AI application, this parameter is a string JSON containing a saveUrl address to receive the processing results. {"saveUrl": "http://xxx.com/ocr"}

          Response Body Parameters

          Description of Data Structure for Response Body Field

          Request Example

          PUT /v1/bucketName_example/?notification
          Common Request Header
          
          
          {
            "notifications" : [ {
              "encryption" : {
                "key" : "06a62b70f47dc4a0a7da349609f1a1ac"
              },
              "appId" : "app-id-1",
              "name" : "rule-name",
              "resources" : [ "bucket-a/path1" ],
              "id" : "notify-id-1",
              "events" : [ "PutObject" ],
              "status" : "enabled",
              "apps" : [ {
                "eventUrl" : "app:ImageOcr",
                "xVars" : "{\"saveUrl\": \"http://xxx.com/ocr\"}",
                "id" : "app-id-3"
              } ]
            } ]
          }

          Response Example

          HTTP/1.1 200 OK
          <Common response header>
          
          { }

          Error Code

          Refer to the universal error code.

          Previous
          Push ImageOcr and ImageClassify Messages
          Next
          Lifecycle