openstack-manuals/doc/user-guide/section_object-api-large-lists.xml
Christian Berendt 3a426a37c3 Use the parameter tag according to the markup conventions
Change-Id: I7d3f26d5acfa3e3f055cd14fb7eb7dbdc5673833
2015-03-01 21:32:37 +01:00

108 lines
5.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section [ <!ENTITY % openstack SYSTEM "../common/entities/openstack.ent"> %openstack; ]>
<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="large-lists">
<title>Page through large lists of containers or objects</title>
<para>If you have a large number of containers or objects, you can
use the <literal>marker</literal>,
<literal>limit</literal>, and
<literal>end_marker</literal> parameters to control
how many items are returned in a list and where the list
starts or ends.</para>
<variablelist>
<varlistentry>
<term><literal>marker</literal></term>
<listitem>
<para>When you request a list of containers or
objects, Object Storage returns a maximum of
10,000 names for each request. To get subsequent
names, you must make another request with the
<literal>marker</literal> parameter. Set
the <literal>marker</literal> parameter to the
name of the last item returned in the previous
list. You must URL-encode the
<literal>marker</literal> value before you
send the HTTP request. Object Storage returns a
maximum of 10,000 names starting after the last
item returned.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>limit</literal></term>
<listitem>
<para>To return fewer than 10,000 names, use the
<literal>limit</literal> parameter. If the
number of names returned equals the specified
<literal>limit</literal> (or 10,000 if you
omit the <literal>limit</literal> parameter),
you can assume there are more names to list. If
the number of names in the list is exactly
divisible by the <literal>limit</literal>
value, the last request has no content.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>end_marker</literal></term>
<listitem>
<para>Limits the result set to names that are less
than the <literal>end_marker</literal>
parameter value. You must URL-encode the
<literal>end_marker</literal> value before
you send the HTTP request.</para>
</listitem>
</varlistentry>
</variablelist>
<procedure>
<title>To page through a large list of containers</title>
<para>Assume the following list of container names:</para>
<literallayout class="monospaced">apples
bananas
kiwis
oranges
pears</literallayout>
<step>
<para>Use a <literal>limit</literal> of two:</para>
<screen><userinput># curl -i $publicURL/?limit=2 -X GET -H "X-Auth-Token: $token"</userinput></screen>
<screen><computeroutput>apples
bananas</computeroutput></screen>
<para>Because two container names are returned, there are
more names to list.</para>
</step>
<step>
<para>Make another request with a
<literal>marker</literal> parameter set to the
name of the last item returned:</para>
<screen><userinput># curl -i $publicURL/?limit=2&amp;amp;marker=bananas -X GET -H "X-Auth-Token: $token"</userinput></screen>
<screen><computeroutput>kiwis
oranges</computeroutput></screen>
<para>Again, two items are returned, and there might be
more.</para>
</step>
<step>
<para>Make another request with a
<literal>marker</literal> of the last item
returned:</para>
<screen><userinput># curl -i $publicURL/?limit=2&amp;amp;marker=oranges -X GET -H "X-Auth-Token: $token"</userinput></screen>
<screen><computeroutput>pears</computeroutput></screen>
<para>You receive a one-item response, which is fewer than
the <literal>limit</literal> number of names. This
indicates that this is the end of the list.</para>
</step>
<step>
<para>Use the <literal>end_marker</literal> parameter
to limit the result set to object names that are less
than the <literal>end_marker</literal> parameter
value:</para>
<screen><userinput># curl -i $publicURL/?end_marker=oranges -X GET -H "X-Auth-Token: $token"</userinput></screen>
<screen><computeroutput>apples
bananas
kiwis</computeroutput></screen>
<para>You receive a result set of all container names
before the <literal>end-marker</literal>
value.</para>
</step>
</procedure>
</section>