Baidu AI Cloud
中国站

百度智能云

Object Storage

DeleteMultipleObjects

Interface Description

This command allows you to delete multiple objects in the same bucket by making an HTTP request.

  • You can delete up to 1,000 objects by making a request.
  • The message body cannot exceed 2 MB.
  • The returned message body only contains the incorrect object results during the deletion. If deleting all objects succeeds, no message body exists.

Request

  • Request syntax

      POST /?delete HTTP/1.1
      Host: <BucketName>.bj.bcebos.com
      Date: <Date>
      Authorization: <AuthorizationString>
      Content-Length: <ContentLength>
      Content-Type: text/plain
    
      {
          "objects": [
              {
                  "key": "my-object1"
              },
              {
                  "key": "my-object2"
              }
          ]
      }
  • Request header field

    No special header parameters.

  • Request parameters

    Parameter Name Query Parameters Description Parent Node
    objects Request body parameter The container that stores the object message to be deleted, which contains one or more object elements. -
    +key Request Body Parameter Object name to be deleted. objects

Response

  • Response header field

    No special header parameter returned.

  • Response parameter

    Parameter Name Description Parent Node
    errors The container for storing incorrect object message during the deletion, which contains one or more object elements. -
    +key Incorrect object name during the deletion. Errors
    +code Error code. Errors
    +message Error message. Errors

Example

  • Request example

      POST /?delete HTTP/1.1
      Host: <BucketName>.bj.bcebos.com
      Date: Wed, 06 Apr 2016 06:34:40 GMT
      Authorization: AuthorizationString
      Content-Length: 11434
      Content-Type: text/plain
    
      {
          "objects": [
              {
                  "key": "my-object1"
              },
              {
                  "key": "my-object2"
              }
           ]
      }
  • Response example

      HTTP/1.1 200 OK
      x-bce-request-id : 4db2b34d-654d-4d8a-b49b-3049ca786409
      Date: Wed, 06 Apr 2016 06:34:40 GMT
      Connection: close
      Content-Length: 1324
      Server: BceBos
    
      {
          "errors": [
              {
                  "key": "my-object1",
                  "code": "NoSuchKey",
                  "message": "The specified key does not exist."
              },
              {
                  "key": "my-object2",
                  "code": "InvalidArgument",
                  "message": "Invalid Argument."
              }
          ]
      }  
Previous
CopyObject
Next
DeleteObject