百度智能云

All Product Document

          Object Storage

          PutNotification

          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, it returns “Error 403”. If the corresponding file does not exist, it returns “Error 404”.

          Request

          • Request syntax

            PUT /?notification HTTP/1.1
            Host: <BucketName>.bj.bcebos.com
            Date: <Date>
            Authorization: <AuthorizationString>
            Content-Type: application/json; charset=utf-8
            Content-Length: <ContentLength>
          • Request parameters

          Field Type Required? Description
          id String Required Rule ID
          name String Optional Rule name
          appId String Required Product ID for registering this rule
          status String Required Optional value: {"disabled", "enabled"}
          encryption Object Optional Encryption method
          +key String Optional 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.
          resources[] Array Required Subscribed resources
          +resource String Required Subscribed resources ${bucket_name}/path1/*.jpg or /path1/*.jpg, which can only contain one*
          events[] Array Required Subscribed event
          +eventType String Required Event type supported currently:
          - PutObject: Common upload object
          - PostObject: Form upload object
          - AppendObject: Append upload object
          - CopyObject: Copy object
          - CompleteMultipartUpload: Complete object multipart upload
          - FetchObject: Fetch object, including fetching generated by the image forward to origin
          - DeleteObject: Delete object
          - DeleteMultipleObjects: Delete multiple objects
          apps[] Array Required Product that subscribes message.
          +id String Required Notified product ID
          +eventUrl String Required 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.
          +xVars String Optional 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 the official AI application, it is a string JSON and contains a saveUrl address to receive the processing results.

          If it is only used to configure the key of notification or callback, it can be simplified to the following parameters:

          Field Type Required? Description
          id String Required Rule ID
          name String Optional Rule name
          appId String Required Product ID for registering this rule
          status String Required Optional value: {"disabled", "enabled"}
          encryption Object Optional Encryption method
          +key String Optional 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.
          • Request header field

            None

          Response

          • Response header field

            None

          • Response element

            None

          Example

          • Request example

            PUT /?notification HTTP/1.1
            Host:  <BucketName>.bj.bcebos.com
            Date: Wed, 12 Sep 2018 06:34:40 GMT
            Authorization: <AthorizationString>
            Content-Type: application/json; charset=utf-8
            Content-Length: 0
            
            {
                "notifications": [
                    {
                        "id": "notify-id-1",
                        "name": "rule-name",
                        "appId": "app-id-1",
                        "status": "enabled",
                        "encryption": {
                            "key": "06a62b70f47dc4a0a7da349609f1a1ac",
                        },
                        "resources": [
                            "bucket-a/path1", "/path2", "/path3/*.jpg", "/path4/*"
                        ],
                        "events": [
                            "PutObject"
                        ],
                        "apps": [
                            {
                                "id": "app-id-1",
                                "eventUrl": "http://xxx.com/event",
                                "xVars": ""
                            },
                            {
                                "id": "app-id-2",
                                "eventUrl": "brn:bce:cfc:bj:1f1c3e38xxxxxxxx4c44523f0d5b22:function:hello_bos:$LATEST"
                            },
                            {
                                "id": "app-id-3",
                                "eventUrl": "app:ImageOcr",
                                "xVars": "{\"saveUrl\": \"http://xxx.com/ocr\"}"
                            }
                        ]
                    }
                ]
            }
          • Response example

            HTTP/1.1 200 OK
            x-bce-request-id: 4db2b34d-654d-4d8a-b49b-xxxxxx786409
            Date: Wed, 12 Sep 2018 06:34:40 GMT
            Content-Length: 0
            Connection: close
            Server: BceBos
          Previous
          Data Synchronization
          Next
          DeleteNotification