Delete multiple containers or objects
/v1/{account}
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
-
account: string
The unique name for the account. An account is also known as the project or tenant.
-
bulk-delete: string
Allow Empty value:
true
Bulk delete operation flag. This parameter takes no value.
-
Accept(optional): string
Indicates the response body format desired by the caller. For bulk operations, the available formats are
text/plain
,application/json
, andapplication/xml
. -
Content-Length(optional): integer
Minimum Value:
0
Set to the length of the body content. -
Content-Type(optional): string
Must be set to
text/plain
-
X-Auth-Token: string
Authentication token.
Response
- application/json
200 Response
object
-
Errors(optional):
array Errors
List of all errors that occurred.
-
Number Deleted(optional):
integer
Minimum Value:
0
-
Number Not Found(optional):
integer
Minimum Value:
0
-
Response Body(optional):
string
Contains a list of items that could not be deleted.
-
Response Status(optional):
string
If all items were successfully deleted (or did not exist), the Response Status will be
200 OK
. If any failed to delete, the response code corresponds to the subrequest's error. Possible codes are400
,401
,502
(on server errors), etc. Please consult Delete object and Delete container for a list of possible status codes.
Examples
cURL Command
Sample Cloud account with the following details:
-
Account name:
acme
-
REST Endpoint URL:
https://acme.storage.oraclecloud.com/v1/Storage-acme
-
REST Endpoint (Permanent) URL:
https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365
Note:
The REST Endpoint (Permanent) URL is displayed for the accounts created after November 2017.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.
-
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
andobject2
incontainer1
-
container1
, if it is empty -
object3
incontainer2
-
container3
, if it is empty
-
-
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
totext/plain
.
-
Using the REST Endpoint URL obtained from the REST Endpoint field in the My Services dashboard:
curl -v -X DELETE \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ -H "Content-Type: text/plain" \ -T objects_to_delete \ "https://acme.storage.oraclecloud.com/v1/Storage-acme?bulk-delete"
The following is an example of the output of this command:
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:
-
Using the Service Permanent REST Endpoint URL obtained from the REST Endpoint (Permanent) field in the My Services dashboard:
Note:
This cURL command example applies to the accounts created after November 2017.curl -v -X DELETE \ -H "X-Auth-Token: AUTH_tkb4fdf39c92e9f62cca9b7c196f8b6e6b" \ -H "Content-Type: text/plain" \ -T objects_to_delete \ "https://storage-7b16fede61e1417ab83eb52e06f0e365.storage.oraclecloud.com/v1/Storage-7b16fede61e1417ab83eb52e06f0e365?bulk-delete"
The following is an example of the output of this command:
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:
-