Delete multiple containers or objects

delete

/v1/{account}

Deletes one or more containers and / or objects.

The body of the request is a plain-text, newline-separated list of URL encoded objects to delete. Each line must be of the form container or container/object. The body is subject to the following conditions and restrictions:

  • When a line is of the form container, the corresponding container must be empty.
  • No more than 10,000 lines (deletions) may be specified per request.
  • After the first 10 deletions have been processed, all subsequent deletions in the request will be processed at a rate not exceeding one deletion every 100msec.

Request

Path Parameters
account
Type: string
Required: true
The unique name for the account. An account is also known as the project or tenant.
Query Parameters
bulk-delete
Type: string
Required: true
Allow Empty value: true
Bulk delete operation flag. This parameter takes no value.
Header Parameters
Accept
Type: string
Indicates the response body format desired by the caller. For bulk operations, the available formats are text/plain, application/json, and application/xml.
Content-Length
Type: integer
Minimum Value: 0
Set to the length of the body content.
Content-Type
Type: string
Must be set to text/plain
X-Auth-Token
Type: string
Required: true
Authentication token.

Response

Supported Media Types
  • application/json
200 Response
A 200 response is always returned. Check the response body for details.
Body
Root Schema : /paths/~1v1~1{account}/delete/responses/200/schema
Type: object
Nested Schema : /paths/~1v1~1{account}/delete/responses/200/schema/properties/Errors
Type: array
List of all errors that occurred.

Examples

cURL Command

The following example shows how to delete multiple containers (and objects in multiple containers) by submitting a DELETE request with the bulk-delete query parameter.

  1. Create a local file that lists the objects to be deleted and the containers they are in.

    Here's a sample of such a file:

    $ cat objects_to_delete
    
    container1/object1
    container1/object2
    container1
    container2/object3
    container3
    
    In this example, the goal is to delete the following:
    • object1 and object2 in container1

    • container1, if it is empty

    • object3 in container2

    • container3, if it is empty

  2. Send a DELETE request to the account URL.
    • Specify the file that contains the list of containers and objects to be deleted.

    • Include the bulk-delete query parameter.

    • Set Content-Type to text/plain.

    curl -v -X DELETE \
         -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \
         -H "Content-Type: text/plain" \
         -T objects_to_delete \
         "https://foo.storage.oraclecloud.com/v1/myservice-bar?bulk-delete"

Sample Response

HTTP/1.1 200 OK
Date: Tue,  28 Jun 2015 11:44:29 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Number Deleted: 5
Number Not Found: 0
Response Body: 
Response Status: 200 OK
Errors: