object-api/v1/section_object-api-bulk-del...

115 lines
5.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section [
<!-- Useful for describing APIs -->
<!ENTITY PUT '<command xmlns="http://docbook.org/ns/docbook">PUT</command>'>
<!ENTITY DELETE '<command xmlns="http://docbook.org/ns/docbook">DELETE</command>'>
<!ENTITY POST '<command xmlns="http://docbook.org/ns/docbook">POST</command>'>
]>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="bulk-delete">
<?dbhtml stop-chunking?>
<title>Bulk delete</title>
<para>To discover whether your Object Storage system supports this
feature, see <xref linkend="discoverability"/>. Alternatively,
check with your service provider.</para>
<para>With bulk delete, you can delete up to 10,000 objects or
containers (configurable) in one request.</para>
<section xml:id="bulk-delete-request">
<title>Bulk delete request</title>
<para>To perform a bulk delete operation, add the
<parameter>bulk-delete</parameter> query parameter to
the path of a &POST; or &DELETE; operation.</para>
<note>
<para>The &DELETE; operation is supported for backwards
compatibility.</para>
</note>
<para>The path is the account, such as
<literal>/v1/12345678912345</literal>, that contains
the objects and containers.</para>
<para>In the request body of the &POST; or &DELETE; operation,
list the objects or containers to be deleted. Separate
each name with a newline character. You can include a
maximum of 10,000 items (configurable) in the list.</para>
<para>In addition, you must:</para>
<itemizedlist>
<listitem>
<para>UTF-8-encode and then URL-encode the
names.</para>
</listitem>
<listitem>
<para>To indicate an object, specify the container and
object name as:
<literal><replaceable>CONTAINER_NAME</replaceable>/<replaceable>OBJECT_NAME</replaceable></literal>.</para>
</listitem>
<listitem>
<para>To indicate a container, specify the container
name as:
<literal><replaceable>CONTAINER_NAME</replaceable></literal>.
Ensure that the container is empty. If it contains
objects, Object Storage cannot delete the
container.</para>
</listitem>
<listitem>
<para>Set the <literal>Content-Type</literal> request
header to <literal>text/plain</literal>.</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="bulk-delete-response">
<title>Bulk delete response</title>
<para>When Object Storage processes the request, it performs
multiple sub-operations. Even if all sub-operations fail,
the operation returns a <returnvalue>200</returnvalue>
status. The bulk operation returns a response body that
contains details that indicate which sub-operations have
succeeded and failed. Some sub-operations might succeed
while others fail: Examine the response body to determine
the results of each delete sub-operation.</para>
<para>You can set the <literal>Accept</literal> request header
to one of these values to define the response
format:</para>
<itemizedlist>
<listitem>
<para><literal>text/plain</literal>. Formats response
as plain text. If you omit the
<literal>Accept</literal> header,
<literal>text/plain</literal> is the
default.</para>
</listitem>
<listitem>
<para><literal>application/json</literal>. Formats
response as JSON.</para>
</listitem>
<listitem>
<para><literal>application/xml</literal> or
<literal>text/xml</literal>. Formats response
as XML.</para>
</listitem>
</itemizedlist>
<para>The response body contains the following
information:</para>
<itemizedlist>
<listitem>
<para>The number of files actually deleted.</para>
</listitem>
<listitem>
<para>The number of not found objects.</para>
</listitem>
<listitem>
<para>Errors. A list of object names and associated
error statuses for the objects that failed to
delete. The format depends on the value that you
set in the <literal>Accept</literal>
header.</para>
</listitem>
</itemizedlist>
<para>The following bulk delete response is in
<literal>application/xml</literal> format. In this
example, the <literal>mycontainer</literal> container is
not empty, so it cannot be deleted.</para>
<programlisting language="xml"><xi:include parse="text" href="samples/bulk-delete-response.xml"/></programlisting>
</section>
</section>