Statistics
| Branch: | Tag: | Revision:

root / docs / source / devguide.rst @ 288c1d55

History | View | Annotate | Download (40 kB)

1 f2d7b5ab Antony Chazapis
Pithos v2 Developer Guide
2 f2d7b5ab Antony Chazapis
=========================
3 f2d7b5ab Antony Chazapis
4 f2d7b5ab Antony Chazapis
Introduction
5 f2d7b5ab Antony Chazapis
------------
6 f2d7b5ab Antony Chazapis
7 f2d7b5ab Antony Chazapis
Pithos is a storage service implemented by GRNET (http://www.grnet.gr). Data is stored as objects, organized in containers, belonging to an account. This hierarchy of storage layers has been inspired by the OpenStack Object Storage (OOS) API and similar CloudFiles API by Rackspace. The Pithos API follows the OOS API as closely as possible. One of the design requirements has been to be able to use Pithos with clients built for the OOS, without changes.
8 f2d7b5ab Antony Chazapis
9 c9af0703 Antony Chazapis
However, to be able to take full advantage of the Pithos infrastructure, client software should be aware of the extensions that differentiate Pithos from OOS. Pithos objects can be updated, or appended to. Automatic version management, allows taking account and container listings back in time, as well as reading previous instances of objects.
10 e9285524 Antony Chazapis
11 c9af0703 Antony Chazapis
The storage backend of Pithos is block oriented, permitting efficient, deduplicated data placement. The block structure of objects is exposed at the API layer, in order to encourage external software to implement advanced data management operations.
12 e9285524 Antony Chazapis
13 f2d7b5ab Antony Chazapis
This document's goals are:
14 f2d7b5ab Antony Chazapis
15 f2d7b5ab Antony Chazapis
* Define the Pithos ReST API that allows the storage and retrieval of data and metadata via HTTP calls
16 f2d7b5ab Antony Chazapis
* Specify metadata semantics and user interface guidelines for a common experience across client software implementations
17 f2d7b5ab Antony Chazapis
18 f2d7b5ab Antony Chazapis
The present document is meant to be read alongside the OOS API documentation. Thus, it is suggested that the reader is familiar with associated technologies, the OOS API as well as the first version of the Pithos API. This document refers to the second version of Pithos. Information on the first version of the storage API can be found at http://code.google.com/p/gss.
19 f2d7b5ab Antony Chazapis
20 f2d7b5ab Antony Chazapis
Whatever marked as to be determined (**TBD**), should not be considered by implementors.
21 f2d7b5ab Antony Chazapis
22 f2d7b5ab Antony Chazapis
Document Revisions
23 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^^^^
24 f2d7b5ab Antony Chazapis
25 f2d7b5ab Antony Chazapis
=========================  ================================
26 f2d7b5ab Antony Chazapis
Revision                   Description
27 f2d7b5ab Antony Chazapis
=========================  ================================
28 8cb45c13 Antony Chazapis
0.3 (June 14, 2011)        Large object support with ``X-Object-Manifest``.
29 8cb45c13 Antony Chazapis
\                          Allow for publicly available objects via ``https://hostname/public``.
30 c9af0703 Antony Chazapis
\                          Support time-variant account/container listings. 
31 c9af0703 Antony Chazapis
\                          Add source version when duplicating with PUT/COPY/MOVE.
32 c9af0703 Antony Chazapis
\                          Request version in object HEAD/GET requests (list versions with GET).
33 6bc372a4 Antony Chazapis
0.2 (May 31, 2011)         Add object meta listing and filtering in containers.
34 6bc372a4 Antony Chazapis
\                          Include underlying storage characteristics in container meta.
35 e9285524 Antony Chazapis
\                          Support for partial object updates through POST.
36 e9285524 Antony Chazapis
\                          Expose object hashmaps through GET.
37 f2d7b5ab Antony Chazapis
\                          Support for multi-range object GET requests.
38 f2d7b5ab Antony Chazapis
0.1 (May 17, 2011)         Initial release. Based on OpenStack Object Storage Developer Guide API v1 (Apr. 15, 2011).
39 f2d7b5ab Antony Chazapis
=========================  ================================
40 f2d7b5ab Antony Chazapis
41 f2d7b5ab Antony Chazapis
The Pithos API
42 f2d7b5ab Antony Chazapis
--------------
43 f2d7b5ab Antony Chazapis
44 c9af0703 Antony Chazapis
The URI requests supported by the Pithos API follow one of the following forms:
45 f2d7b5ab Antony Chazapis
46 f2d7b5ab Antony Chazapis
* Top level: ``https://hostname/v1/``
47 f2d7b5ab Antony Chazapis
* Account level: ``https://hostname/v1/<account>``
48 f2d7b5ab Antony Chazapis
* Container level: ``https://hostname/v1/<account>/<container>``
49 f2d7b5ab Antony Chazapis
* Object level: ``https://hostname/v1/<account>/<container>/<object>``
50 f2d7b5ab Antony Chazapis
51 c9af0703 Antony Chazapis
All requests must include an ``X-Auth-Token``. The process of obtaining the token is still to be determined (**TBD**).
52 f2d7b5ab Antony Chazapis
53 e9285524 Antony Chazapis
The allowable request operations and respective return codes per level are presented in the remainder of this chapter. Common to all requests are the following return codes.
54 f2d7b5ab Antony Chazapis
55 f2d7b5ab Antony Chazapis
=========================  ================================
56 f2d7b5ab Antony Chazapis
Return Code                Description
57 f2d7b5ab Antony Chazapis
=========================  ================================
58 f2d7b5ab Antony Chazapis
400 (Bad Request)          The request is invalid
59 f2d7b5ab Antony Chazapis
401 (Unauthorized)         Request not allowed
60 f2d7b5ab Antony Chazapis
404 (Not Found)            The requested resource was not found
61 f2d7b5ab Antony Chazapis
503 (Service Unavailable)  The request cannot be completed because of an internal error
62 f2d7b5ab Antony Chazapis
=========================  ================================
63 f2d7b5ab Antony Chazapis
64 f2d7b5ab Antony Chazapis
Top Level
65 f2d7b5ab Antony Chazapis
^^^^^^^^^
66 f2d7b5ab Antony Chazapis
67 f2d7b5ab Antony Chazapis
List of operations:
68 f2d7b5ab Antony Chazapis
69 f2d7b5ab Antony Chazapis
=========  ==================
70 f2d7b5ab Antony Chazapis
Operation  Description
71 f2d7b5ab Antony Chazapis
=========  ==================
72 f2d7b5ab Antony Chazapis
GET        Authentication. This is kept for compatibility with the OOS API
73 f2d7b5ab Antony Chazapis
=========  ==================
74 f2d7b5ab Antony Chazapis
75 f2d7b5ab Antony Chazapis
GET
76 f2d7b5ab Antony Chazapis
"""
77 f2d7b5ab Antony Chazapis
78 f2d7b5ab Antony Chazapis
If the ``X-Auth-User`` and ``X-Auth-Key`` headers are given, a dummy ``X-Auth-Token`` and ``X-Storage-Url`` will be replied, which can be used as a guest token/namespace for testing Pithos.
79 f2d7b5ab Antony Chazapis
80 f2d7b5ab Antony Chazapis
================  =====================
81 f2d7b5ab Antony Chazapis
Return Code       Description
82 f2d7b5ab Antony Chazapis
================  =====================
83 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
84 f2d7b5ab Antony Chazapis
================  =====================
85 f2d7b5ab Antony Chazapis
86 f2d7b5ab Antony Chazapis
87 f2d7b5ab Antony Chazapis
Account Level
88 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^
89 f2d7b5ab Antony Chazapis
90 f2d7b5ab Antony Chazapis
List of operations:
91 f2d7b5ab Antony Chazapis
92 f2d7b5ab Antony Chazapis
=========  ==================
93 f2d7b5ab Antony Chazapis
Operation  Description
94 f2d7b5ab Antony Chazapis
=========  ==================
95 f2d7b5ab Antony Chazapis
HEAD       Retrieve account metadata
96 f2d7b5ab Antony Chazapis
GET        List containers
97 f2d7b5ab Antony Chazapis
POST       Update account metadata
98 f2d7b5ab Antony Chazapis
=========  ==================
99 f2d7b5ab Antony Chazapis
100 f2d7b5ab Antony Chazapis
HEAD
101 f2d7b5ab Antony Chazapis
""""
102 f2d7b5ab Antony Chazapis
103 c9af0703 Antony Chazapis
======================  ===================================
104 c9af0703 Antony Chazapis
Request Parameter Name  Value
105 c9af0703 Antony Chazapis
======================  ===================================
106 c9af0703 Antony Chazapis
until                   Optional timestamp
107 c9af0703 Antony Chazapis
======================  ===================================
108 c9af0703 Antony Chazapis
109 c9af0703 Antony Chazapis
|
110 f2d7b5ab Antony Chazapis
111 f2d7b5ab Antony Chazapis
==========================  =====================
112 f2d7b5ab Antony Chazapis
Reply Header Name           Value
113 f2d7b5ab Antony Chazapis
==========================  =====================
114 f2d7b5ab Antony Chazapis
X-Account-Container-Count   The total number of containers
115 f2d7b5ab Antony Chazapis
X-Account-Object-Count      The total number of objects (**TBD**)
116 f2d7b5ab Antony Chazapis
X-Account-Bytes-Used        The total number of bytes stored
117 f2d7b5ab Antony Chazapis
X-Account-Bytes-Remaining   The total number of bytes remaining (**TBD**)
118 f2d7b5ab Antony Chazapis
X-Account-Last-Login        The last login (**TBD**)
119 c9af0703 Antony Chazapis
X-Account-Until-Timestamp   The last account modification date until the timestamp provided
120 f2d7b5ab Antony Chazapis
X-Account-Meta-*            Optional user defined metadata
121 c9af0703 Antony Chazapis
Last-Modified               The last account modification date (regardless of ``until``)
122 f2d7b5ab Antony Chazapis
==========================  =====================
123 f2d7b5ab Antony Chazapis
124 f2d7b5ab Antony Chazapis
|
125 f2d7b5ab Antony Chazapis
126 f2d7b5ab Antony Chazapis
================  =====================
127 f2d7b5ab Antony Chazapis
Return Code       Description
128 f2d7b5ab Antony Chazapis
================  =====================
129 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
130 f2d7b5ab Antony Chazapis
================  =====================
131 f2d7b5ab Antony Chazapis
132 f2d7b5ab Antony Chazapis
133 f2d7b5ab Antony Chazapis
GET
134 f2d7b5ab Antony Chazapis
"""
135 f2d7b5ab Antony Chazapis
136 f2d7b5ab Antony Chazapis
====================  ===========================
137 f2d7b5ab Antony Chazapis
Request Header Name   Value
138 f2d7b5ab Antony Chazapis
====================  ===========================
139 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if account has changed since provided timestamp
140 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if account has not changed since provided timestamp
141 f2d7b5ab Antony Chazapis
====================  ===========================
142 f2d7b5ab Antony Chazapis
143 f2d7b5ab Antony Chazapis
|
144 f2d7b5ab Antony Chazapis
145 f2d7b5ab Antony Chazapis
======================  =========================
146 f2d7b5ab Antony Chazapis
Request Parameter Name  Value
147 f2d7b5ab Antony Chazapis
======================  =========================
148 f2d7b5ab Antony Chazapis
limit                   The amount of results requested (default is 10000)
149 f2d7b5ab Antony Chazapis
marker                  Return containers with name lexicographically after marker
150 f2d7b5ab Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
151 c9af0703 Antony Chazapis
until                   Optional timestamp
152 f2d7b5ab Antony Chazapis
======================  =========================
153 f2d7b5ab Antony Chazapis
154 f2d7b5ab Antony Chazapis
The reply is a list of container names. Account headers (as in a ``HEAD`` request) will also be included.
155 f2d7b5ab Antony Chazapis
If a ``format=xml`` or ``format=json`` argument is given, extended information on the containers will be returned, serialized in the chosen format.
156 f2d7b5ab Antony Chazapis
For each container, the information will include all container metadata (names will be in lower case and with hyphens replaced with underscores):
157 f2d7b5ab Antony Chazapis
158 c9af0703 Antony Chazapis
===========================  ============================
159 c9af0703 Antony Chazapis
Name                         Description
160 c9af0703 Antony Chazapis
===========================  ============================
161 c9af0703 Antony Chazapis
name                         The name of the container
162 c9af0703 Antony Chazapis
count                        The number of objects inside the container
163 c9af0703 Antony Chazapis
bytes                        The total size of the objects inside the container
164 c9af0703 Antony Chazapis
last_modified                The last container modification date (regardless of ``until``)
165 c9af0703 Antony Chazapis
x_container_until_timestamp  The last container modification date until the timestamp provided
166 c9af0703 Antony Chazapis
x_container_meta_*           Optional user defined metadata
167 c9af0703 Antony Chazapis
===========================  ============================
168 f2d7b5ab Antony Chazapis
169 f2d7b5ab Antony Chazapis
For examples of container details returned in JSON/XML formats refer to the OOS API documentation.
170 f2d7b5ab Antony Chazapis
171 6bc372a4 Antony Chazapis
===========================  =====================
172 6bc372a4 Antony Chazapis
Return Code                  Description
173 6bc372a4 Antony Chazapis
===========================  =====================
174 6bc372a4 Antony Chazapis
200 (OK)                     The request succeeded
175 6bc372a4 Antony Chazapis
204 (No Content)             The account has no containers (only for non-extended replies)
176 6bc372a4 Antony Chazapis
304 (Not Modified)           The account has not been modified
177 6bc372a4 Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
178 6bc372a4 Antony Chazapis
===========================  =====================
179 f2d7b5ab Antony Chazapis
180 f2d7b5ab Antony Chazapis
Will use a ``200`` return code if the reply is of type json/xml.
181 f2d7b5ab Antony Chazapis
182 f2d7b5ab Antony Chazapis
183 f2d7b5ab Antony Chazapis
POST
184 f2d7b5ab Antony Chazapis
""""
185 f2d7b5ab Antony Chazapis
186 f2d7b5ab Antony Chazapis
====================  ===========================
187 f2d7b5ab Antony Chazapis
Request Header Name   Value
188 f2d7b5ab Antony Chazapis
====================  ===========================
189 f2d7b5ab Antony Chazapis
X-Account-Meta-*      Optional user defined metadata
190 f2d7b5ab Antony Chazapis
====================  ===========================
191 f2d7b5ab Antony Chazapis
192 f2d7b5ab Antony Chazapis
No reply content/headers.
193 f2d7b5ab Antony Chazapis
194 f2d7b5ab Antony Chazapis
The update operation will overwrite all user defined metadata.
195 f2d7b5ab Antony Chazapis
196 f2d7b5ab Antony Chazapis
================  ===============================
197 f2d7b5ab Antony Chazapis
Return Code       Description
198 f2d7b5ab Antony Chazapis
================  ===============================
199 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
200 f2d7b5ab Antony Chazapis
================  ===============================
201 f2d7b5ab Antony Chazapis
202 f2d7b5ab Antony Chazapis
203 f2d7b5ab Antony Chazapis
Container Level
204 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^
205 f2d7b5ab Antony Chazapis
206 f2d7b5ab Antony Chazapis
List of operations:
207 f2d7b5ab Antony Chazapis
208 f2d7b5ab Antony Chazapis
=========  ============================
209 f2d7b5ab Antony Chazapis
Operation  Description
210 f2d7b5ab Antony Chazapis
=========  ============================
211 f2d7b5ab Antony Chazapis
HEAD       Retrieve container metadata
212 f2d7b5ab Antony Chazapis
GET        List objects
213 f2d7b5ab Antony Chazapis
PUT        Create/update container
214 f2d7b5ab Antony Chazapis
POST       Update container metadata
215 f2d7b5ab Antony Chazapis
DELETE     Delete container
216 f2d7b5ab Antony Chazapis
=========  ============================
217 f2d7b5ab Antony Chazapis
218 f2d7b5ab Antony Chazapis
219 f2d7b5ab Antony Chazapis
HEAD
220 f2d7b5ab Antony Chazapis
""""
221 f2d7b5ab Antony Chazapis
222 c9af0703 Antony Chazapis
======================  ===================================
223 c9af0703 Antony Chazapis
Request Parameter Name  Value
224 c9af0703 Antony Chazapis
======================  ===================================
225 c9af0703 Antony Chazapis
until                   Optional timestamp
226 c9af0703 Antony Chazapis
======================  ===================================
227 f2d7b5ab Antony Chazapis
228 c9af0703 Antony Chazapis
|
229 c9af0703 Antony Chazapis
230 c9af0703 Antony Chazapis
===========================  ===============================
231 c9af0703 Antony Chazapis
Reply Header Name            Value
232 c9af0703 Antony Chazapis
===========================  ===============================
233 c9af0703 Antony Chazapis
X-Container-Object-Count     The total number of objects in the container
234 c9af0703 Antony Chazapis
X-Container-Bytes-Used       The total number of bytes of all objects stored
235 c9af0703 Antony Chazapis
X-Container-Block-Size       The block size used by the storage backend
236 c9af0703 Antony Chazapis
X-Container-Block-Hash       The hash algorithm used for block identifiers in object hashmaps
237 c9af0703 Antony Chazapis
X-Container-Until-Timestamp  The last container modification date until the timestamp provided
238 c9af0703 Antony Chazapis
X-Container-Object-Meta      A list with all meta keys used by objects
239 c9af0703 Antony Chazapis
X-Container-Meta-*           Optional user defined metadata
240 c9af0703 Antony Chazapis
Last-Modified                The last container modification date (regardless of ``until``)
241 c9af0703 Antony Chazapis
===========================  ===============================
242 f2d7b5ab Antony Chazapis
243 f2d7b5ab Antony Chazapis
The keys returned in ``X-Container-Object-Meta`` are all the unique strings after the ``X-Object-Meta-`` prefix.
244 f2d7b5ab Antony Chazapis
245 f2d7b5ab Antony Chazapis
================  ===============================
246 f2d7b5ab Antony Chazapis
Return Code       Description
247 f2d7b5ab Antony Chazapis
================  ===============================
248 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
249 f2d7b5ab Antony Chazapis
================  ===============================
250 f2d7b5ab Antony Chazapis
251 f2d7b5ab Antony Chazapis
252 f2d7b5ab Antony Chazapis
GET
253 f2d7b5ab Antony Chazapis
"""
254 f2d7b5ab Antony Chazapis
255 f2d7b5ab Antony Chazapis
====================  ===========================
256 f2d7b5ab Antony Chazapis
Request Header Name   Value
257 f2d7b5ab Antony Chazapis
====================  ===========================
258 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if container has changed since provided timestamp
259 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if container has not changed since provided timestamp
260 f2d7b5ab Antony Chazapis
====================  ===========================
261 f2d7b5ab Antony Chazapis
262 f2d7b5ab Antony Chazapis
|
263 f2d7b5ab Antony Chazapis
264 f2d7b5ab Antony Chazapis
======================  ===================================
265 f2d7b5ab Antony Chazapis
Request Parameter Name  Value
266 f2d7b5ab Antony Chazapis
======================  ===================================
267 f2d7b5ab Antony Chazapis
limit                   The amount of results requested (default is 10000)
268 f2d7b5ab Antony Chazapis
marker                  Return containers with name lexicographically after marker
269 f2d7b5ab Antony Chazapis
prefix                  Return objects starting with prefix
270 f2d7b5ab Antony Chazapis
delimiter               Return objects up to the delimiter (discussion follows)
271 f2d7b5ab Antony Chazapis
path                    Assume ``prefix=path`` and ``delimiter=/``
272 f2d7b5ab Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
273 f2d7b5ab Antony Chazapis
meta                    Return objects having the specified meta keys (can be a comma separated list)
274 c9af0703 Antony Chazapis
until                   Optional timestamp
275 f2d7b5ab Antony Chazapis
======================  ===================================
276 f2d7b5ab Antony Chazapis
277 f2d7b5ab Antony Chazapis
The ``path`` parameter overrides ``prefix`` and ``delimiter``. When using ``path``, results will include objects ending in ``delimiter``.
278 f2d7b5ab Antony Chazapis
279 f2d7b5ab Antony Chazapis
The keys given with ``meta`` will be matched with the strings after the ``X-Object-Meta-`` prefix.
280 f2d7b5ab Antony Chazapis
281 f2d7b5ab Antony Chazapis
The reply is a list of object names. Container headers (as in a ``HEAD`` request) will also be included.
282 f2d7b5ab Antony Chazapis
If a ``format=xml`` or ``format=json`` argument is given, extended information on the objects will be returned, serialized in the chosen format.
283 f2d7b5ab Antony Chazapis
For each object, the information will include all object metadata (names will be in lower case and with hyphens replaced with underscores):
284 f2d7b5ab Antony Chazapis
285 c9af0703 Antony Chazapis
==========================  ======================================
286 c9af0703 Antony Chazapis
Name                        Description
287 c9af0703 Antony Chazapis
==========================  ======================================
288 c9af0703 Antony Chazapis
name                        The name of the object
289 c9af0703 Antony Chazapis
hash                        The ETag of the object
290 c9af0703 Antony Chazapis
bytes                       The size of the object
291 c9af0703 Antony Chazapis
content_type                The MIME content type of the object
292 c9af0703 Antony Chazapis
content_encoding            The encoding of the object (optional)
293 c9af0703 Antony Chazapis
content-disposition         The presentation style of the object (optional)
294 c9af0703 Antony Chazapis
last_modified               The last object modification date (regardless of version)
295 c9af0703 Antony Chazapis
x_object_version            The object's version identifier
296 c9af0703 Antony Chazapis
x_object_version_timestamp  The object's version timestamp
297 6d817842 Antony Chazapis
x_object_manifest           Object parts prefix in ``<container>/<object>`` form (optional)
298 cb146cf9 Antony Chazapis
x_object_public             Object is publicly accessible (optional) (**TBD**)
299 c9af0703 Antony Chazapis
x_object_meta_*             Optional user defined metadata
300 c9af0703 Antony Chazapis
==========================  ======================================
301 f2d7b5ab Antony Chazapis
302 f2d7b5ab Antony Chazapis
Extended replies may also include virtual directory markers in separate sections of the ``json`` or ``xml`` results.
303 f2d7b5ab Antony Chazapis
Virtual directory markers are only included when ``delimiter`` is explicitly set. They correspond to the substrings up to and including the first occurrence of the delimiter.
304 f2d7b5ab Antony Chazapis
In JSON results they appear as dictionaries with only a ``"subdir"`` key. In XML results they appear interleaved with ``<object>`` tags as ``<subdir name="..." />``.
305 f2d7b5ab Antony Chazapis
In case there is an object with the same name as a virtual directory marker, the object will be returned.
306 c9af0703 Antony Chazapis
307 f2d7b5ab Antony Chazapis
For examples of object details returned in JSON/XML formats refer to the OOS API documentation.
308 f2d7b5ab Antony Chazapis
309 6bc372a4 Antony Chazapis
===========================  ===============================
310 6bc372a4 Antony Chazapis
Return Code                  Description
311 6bc372a4 Antony Chazapis
===========================  ===============================
312 6bc372a4 Antony Chazapis
200 (OK)                     The request succeeded
313 6bc372a4 Antony Chazapis
204 (No Content)             The account has no containers (only for non-extended replies)
314 6bc372a4 Antony Chazapis
304 (Not Modified)           The container has not been modified
315 6bc372a4 Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
316 6bc372a4 Antony Chazapis
===========================  ===============================
317 f2d7b5ab Antony Chazapis
318 f2d7b5ab Antony Chazapis
Will use a ``200`` return code if the reply is of type json/xml.
319 f2d7b5ab Antony Chazapis
320 f2d7b5ab Antony Chazapis
321 f2d7b5ab Antony Chazapis
PUT
322 f2d7b5ab Antony Chazapis
"""
323 f2d7b5ab Antony Chazapis
324 f2d7b5ab Antony Chazapis
====================  ================================
325 f2d7b5ab Antony Chazapis
Request Header Name   Value
326 f2d7b5ab Antony Chazapis
====================  ================================
327 f2d7b5ab Antony Chazapis
X-Container-Meta-*    Optional user defined metadata
328 f2d7b5ab Antony Chazapis
====================  ================================
329 f2d7b5ab Antony Chazapis
 
330 f2d7b5ab Antony Chazapis
No reply content/headers.
331 f2d7b5ab Antony Chazapis
 
332 f2d7b5ab Antony Chazapis
================  ===============================
333 f2d7b5ab Antony Chazapis
Return Code       Description
334 f2d7b5ab Antony Chazapis
================  ===============================
335 f2d7b5ab Antony Chazapis
201 (Created)     The container has been created
336 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
337 f2d7b5ab Antony Chazapis
================  ===============================
338 f2d7b5ab Antony Chazapis
339 f2d7b5ab Antony Chazapis
340 f2d7b5ab Antony Chazapis
POST
341 f2d7b5ab Antony Chazapis
""""
342 f2d7b5ab Antony Chazapis
343 f2d7b5ab Antony Chazapis
====================  ================================
344 f2d7b5ab Antony Chazapis
Request Header Name   Value
345 f2d7b5ab Antony Chazapis
====================  ================================
346 f2d7b5ab Antony Chazapis
X-Container-Meta-*    Optional user defined metadata
347 f2d7b5ab Antony Chazapis
====================  ================================
348 f2d7b5ab Antony Chazapis
349 f2d7b5ab Antony Chazapis
No reply content/headers.
350 f2d7b5ab Antony Chazapis
351 f2d7b5ab Antony Chazapis
The update operation will overwrite all user defined metadata.
352 f2d7b5ab Antony Chazapis
353 f2d7b5ab Antony Chazapis
================  ===============================
354 f2d7b5ab Antony Chazapis
Return Code       Description
355 f2d7b5ab Antony Chazapis
================  ===============================
356 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
357 f2d7b5ab Antony Chazapis
================  ===============================
358 f2d7b5ab Antony Chazapis
359 f2d7b5ab Antony Chazapis
360 f2d7b5ab Antony Chazapis
DELETE
361 f2d7b5ab Antony Chazapis
""""""
362 f2d7b5ab Antony Chazapis
363 f2d7b5ab Antony Chazapis
No request parameters/headers.
364 f2d7b5ab Antony Chazapis
365 f2d7b5ab Antony Chazapis
No reply content/headers.
366 f2d7b5ab Antony Chazapis
367 f2d7b5ab Antony Chazapis
================  ===============================
368 f2d7b5ab Antony Chazapis
Return Code       Description
369 f2d7b5ab Antony Chazapis
================  ===============================
370 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
371 f2d7b5ab Antony Chazapis
409 (Conflict)    The container is not empty
372 f2d7b5ab Antony Chazapis
================  ===============================
373 f2d7b5ab Antony Chazapis
374 f2d7b5ab Antony Chazapis
375 f2d7b5ab Antony Chazapis
Object Level
376 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^
377 f2d7b5ab Antony Chazapis
378 f2d7b5ab Antony Chazapis
List of operations:
379 f2d7b5ab Antony Chazapis
380 f2d7b5ab Antony Chazapis
=========  =================================
381 f2d7b5ab Antony Chazapis
Operation  Description
382 f2d7b5ab Antony Chazapis
=========  =================================
383 f2d7b5ab Antony Chazapis
HEAD       Retrieve object metadata
384 f2d7b5ab Antony Chazapis
GET        Read object data
385 f2d7b5ab Antony Chazapis
PUT        Write object data or copy/move object
386 f2d7b5ab Antony Chazapis
COPY       Copy object
387 f2d7b5ab Antony Chazapis
MOVE       Move object
388 6bc372a4 Antony Chazapis
POST       Update object metadata/data
389 f2d7b5ab Antony Chazapis
DELETE     Delete object
390 f2d7b5ab Antony Chazapis
=========  =================================
391 f2d7b5ab Antony Chazapis
392 f2d7b5ab Antony Chazapis
393 f2d7b5ab Antony Chazapis
HEAD
394 f2d7b5ab Antony Chazapis
""""
395 f2d7b5ab Antony Chazapis
396 c9af0703 Antony Chazapis
======================  ===================================
397 c9af0703 Antony Chazapis
Request Parameter Name  Value
398 c9af0703 Antony Chazapis
======================  ===================================
399 c9af0703 Antony Chazapis
version                 Optional version identifier
400 c9af0703 Antony Chazapis
======================  ===================================
401 c9af0703 Antony Chazapis
402 c9af0703 Antony Chazapis
|
403 f2d7b5ab Antony Chazapis
404 f2d7b5ab Antony Chazapis
==========================  ===============================
405 f2d7b5ab Antony Chazapis
Reply Header Name           Value
406 f2d7b5ab Antony Chazapis
==========================  ===============================
407 e9285524 Antony Chazapis
ETag                        The ETag of the object
408 f2d7b5ab Antony Chazapis
Content-Length              The size of the object
409 f2d7b5ab Antony Chazapis
Content-Type                The MIME content type of the object
410 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
411 f2d7b5ab Antony Chazapis
Content-Encoding            The encoding of the object (optional)
412 f2d7b5ab Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
413 c9af0703 Antony Chazapis
X-Object-Version            The object's version identifier
414 c9af0703 Antony Chazapis
X-Object-Version-Timestamp  The object's version timestamp
415 6d817842 Antony Chazapis
X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
416 cb146cf9 Antony Chazapis
X-Object-Public             Object is publicly accessible (optional) (**TBD**)
417 f2d7b5ab Antony Chazapis
X-Object-Meta-*             Optional user defined metadata
418 f2d7b5ab Antony Chazapis
==========================  ===============================
419 f2d7b5ab Antony Chazapis
420 f2d7b5ab Antony Chazapis
|
421 f2d7b5ab Antony Chazapis
422 f2d7b5ab Antony Chazapis
================  ===============================
423 f2d7b5ab Antony Chazapis
Return Code       Description
424 f2d7b5ab Antony Chazapis
================  ===============================
425 cb146cf9 Antony Chazapis
200 (No Content)  The request succeeded
426 f2d7b5ab Antony Chazapis
================  ===============================
427 f2d7b5ab Antony Chazapis
428 f2d7b5ab Antony Chazapis
429 f2d7b5ab Antony Chazapis
GET
430 f2d7b5ab Antony Chazapis
"""
431 f2d7b5ab Antony Chazapis
432 f2d7b5ab Antony Chazapis
====================  ================================
433 f2d7b5ab Antony Chazapis
Request Header Name   Value
434 f2d7b5ab Antony Chazapis
====================  ================================
435 f2d7b5ab Antony Chazapis
Range                 Optional range of data to retrieve
436 f2d7b5ab Antony Chazapis
If-Match              Retrieve if ETags match
437 f2d7b5ab Antony Chazapis
If-None-Match         Retrieve if ETags don't match
438 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if object has changed since provided timestamp
439 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if object has not changed since provided timestamp
440 f2d7b5ab Antony Chazapis
====================  ================================
441 f2d7b5ab Antony Chazapis
442 e9285524 Antony Chazapis
|
443 e9285524 Antony Chazapis
444 e9285524 Antony Chazapis
======================  ===================================
445 e9285524 Antony Chazapis
Request Parameter Name  Value
446 e9285524 Antony Chazapis
======================  ===================================
447 e9285524 Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
448 c9af0703 Antony Chazapis
version                 Optional version identifier or ``list`` (specify a format if requesting a list)
449 e9285524 Antony Chazapis
======================  ===================================
450 e9285524 Antony Chazapis
451 c9af0703 Antony Chazapis
The reply is the object's data (or part of it), except if a hashmap is requested with the ``format`` parameter, or a version list with ``version=list`` (in which case an extended reply format must be specified). Object headers (as in a ``HEAD`` request) are always included.
452 e9285524 Antony Chazapis
453 6bc372a4 Antony Chazapis
Hashmaps expose the underlying storage format of the object. Note that each hash is computed after trimming trailing null bytes of the corresponding block.
454 e9285524 Antony Chazapis
455 e9285524 Antony Chazapis
Example ``format=json`` reply:
456 e9285524 Antony Chazapis
457 e9285524 Antony Chazapis
::
458 e9285524 Antony Chazapis
459 c9af0703 Antony Chazapis
  {"block_hash": "sha1", "hashes": ["7295c41da03d7f916440b98e32c4a2a39351546c", ...], "block_size": 131072, "bytes": 242}
460 e9285524 Antony Chazapis
461 e9285524 Antony Chazapis
Example ``format=xml`` reply:
462 e9285524 Antony Chazapis
463 e9285524 Antony Chazapis
::
464 e9285524 Antony Chazapis
465 e9285524 Antony Chazapis
  <?xml version="1.0" encoding="UTF-8"?>
466 6bc372a4 Antony Chazapis
  <object name="file" bytes="24223726" block_size="131072" block_hash="sha1">
467 e9285524 Antony Chazapis
    <hash>7295c41da03d7f916440b98e32c4a2a39351546c</hash>
468 e9285524 Antony Chazapis
    <hash>...</hash>
469 e9285524 Antony Chazapis
  </object>
470 f2d7b5ab Antony Chazapis
471 c9af0703 Antony Chazapis
Version lists include the version identifier and timestamp for each available object version. Version identifiers are integers, with the only requirement that newer versions have a larger identifier than previous ones.
472 c9af0703 Antony Chazapis
473 c9af0703 Antony Chazapis
Example ``format=json`` reply:
474 c9af0703 Antony Chazapis
475 c9af0703 Antony Chazapis
::
476 c9af0703 Antony Chazapis
477 c9af0703 Antony Chazapis
  {"versions": [[23, 1307700892], [28, 1307700898], ...]}
478 c9af0703 Antony Chazapis
479 c9af0703 Antony Chazapis
Example ``format=xml`` reply:
480 c9af0703 Antony Chazapis
481 c9af0703 Antony Chazapis
::
482 c9af0703 Antony Chazapis
483 c9af0703 Antony Chazapis
  <?xml version="1.0" encoding="UTF-8"?>
484 c9af0703 Antony Chazapis
  <object name="file">
485 c9af0703 Antony Chazapis
    <version timestamp="1307700892">23</version>
486 c9af0703 Antony Chazapis
    <version timestamp="1307700898">28</version>
487 c9af0703 Antony Chazapis
    <version timestamp="...">...</version>
488 c9af0703 Antony Chazapis
  </object>
489 c9af0703 Antony Chazapis
490 f2d7b5ab Antony Chazapis
The ``Range`` header may include multiple ranges, as outlined in RFC2616. Then the ``Content-Type`` of the reply will be ``multipart/byteranges`` and each part will include a ``Content-Range`` header.
491 f2d7b5ab Antony Chazapis
492 f2d7b5ab Antony Chazapis
==========================  ===============================
493 f2d7b5ab Antony Chazapis
Reply Header Name           Value
494 f2d7b5ab Antony Chazapis
==========================  ===============================
495 e9285524 Antony Chazapis
ETag                        The ETag of the object
496 f2d7b5ab Antony Chazapis
Content-Length              The size of the data returned
497 f2d7b5ab Antony Chazapis
Content-Type                The MIME content type of the object
498 f2d7b5ab Antony Chazapis
Content-Range               The range of data included (only on a single range request)
499 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
500 f2d7b5ab Antony Chazapis
Content-Encoding            The encoding of the object (optional)
501 f2d7b5ab Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
502 c9af0703 Antony Chazapis
X-Object-Version            The object's version identifier
503 c9af0703 Antony Chazapis
X-Object-Version-Timestamp  The object's version timestamp
504 6d817842 Antony Chazapis
X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
505 cb146cf9 Antony Chazapis
X-Object-Public             Object is publicly accessible (optional) (**TBD**)
506 f2d7b5ab Antony Chazapis
X-Object-Meta-*             Optional user defined metadata
507 f2d7b5ab Antony Chazapis
==========================  ===============================
508 f2d7b5ab Antony Chazapis
509 f2d7b5ab Antony Chazapis
|
510 f2d7b5ab Antony Chazapis
511 f2d7b5ab Antony Chazapis
===========================  ==============================
512 f2d7b5ab Antony Chazapis
Return Code                  Description
513 f2d7b5ab Antony Chazapis
===========================  ==============================
514 f2d7b5ab Antony Chazapis
200 (OK)                     The request succeeded
515 f2d7b5ab Antony Chazapis
206 (Partial Content)        The range request succeeded
516 f2d7b5ab Antony Chazapis
304 (Not Modified)           The object has not been modified
517 f2d7b5ab Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
518 f2d7b5ab Antony Chazapis
416 (Range Not Satisfiable)  The requested range is out of limits
519 f2d7b5ab Antony Chazapis
===========================  ==============================
520 f2d7b5ab Antony Chazapis
521 f2d7b5ab Antony Chazapis
522 f2d7b5ab Antony Chazapis
PUT
523 f2d7b5ab Antony Chazapis
"""
524 f2d7b5ab Antony Chazapis
525 f2d7b5ab Antony Chazapis
====================  ================================
526 f2d7b5ab Antony Chazapis
Request Header Name   Value
527 f2d7b5ab Antony Chazapis
====================  ================================
528 f2d7b5ab Antony Chazapis
ETag                  The MD5 hash of the object (optional to check written data)
529 f2d7b5ab Antony Chazapis
Content-Length        The size of the data written
530 f2d7b5ab Antony Chazapis
Content-Type          The MIME content type of the object
531 f2d7b5ab Antony Chazapis
Transfer-Encoding     Set to ``chunked`` to specify incremental uploading (if used, ``Content-Length`` is ignored)
532 f2d7b5ab Antony Chazapis
X-Copy-From           The source path in the form ``/<container>/<object>``
533 f2d7b5ab Antony Chazapis
X-Move-From           The source path in the form ``/<container>/<object>``
534 cb146cf9 Antony Chazapis
X-Source-Version      The source version to copy from
535 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
536 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
537 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
538 cb146cf9 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional) (**TBD**)
539 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
540 f2d7b5ab Antony Chazapis
====================  ================================
541 f2d7b5ab Antony Chazapis
542 f2d7b5ab Antony Chazapis
|
543 f2d7b5ab Antony Chazapis
544 f2d7b5ab Antony Chazapis
==========================  ===============================
545 f2d7b5ab Antony Chazapis
Reply Header Name           Value
546 f2d7b5ab Antony Chazapis
==========================  ===============================
547 f2d7b5ab Antony Chazapis
ETag                        The MD5 hash of the object (on create)
548 f2d7b5ab Antony Chazapis
==========================  ===============================
549 f2d7b5ab Antony Chazapis
550 f2d7b5ab Antony Chazapis
|
551 f2d7b5ab Antony Chazapis
552 f2d7b5ab Antony Chazapis
===========================  ==============================
553 f2d7b5ab Antony Chazapis
Return Code                  Description
554 f2d7b5ab Antony Chazapis
===========================  ==============================
555 f2d7b5ab Antony Chazapis
201 (Created)                The object has been created
556 f2d7b5ab Antony Chazapis
411 (Length Required)        Missing ``Content-Length`` or ``Content-Type`` in the request
557 f2d7b5ab Antony Chazapis
422 (Unprocessable Entity)   The MD5 checksum of the data written to the storage system does not match the (optionally) supplied ETag value
558 f2d7b5ab Antony Chazapis
===========================  ==============================
559 f2d7b5ab Antony Chazapis
560 f2d7b5ab Antony Chazapis
561 f2d7b5ab Antony Chazapis
COPY
562 f2d7b5ab Antony Chazapis
""""
563 f2d7b5ab Antony Chazapis
564 f2d7b5ab Antony Chazapis
====================  ================================
565 f2d7b5ab Antony Chazapis
Request Header Name   Value
566 f2d7b5ab Antony Chazapis
====================  ================================
567 f2d7b5ab Antony Chazapis
Destination           The destination path in the form ``/<container>/<object>``
568 f2d7b5ab Antony Chazapis
Content-Type          The MIME content type of the object (optional)
569 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
570 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
571 cb146cf9 Antony Chazapis
X-Source-Version      The source version to copy from
572 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
573 cb146cf9 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional) (**TBD**)
574 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
575 f2d7b5ab Antony Chazapis
====================  ================================
576 f2d7b5ab Antony Chazapis
577 f2d7b5ab Antony Chazapis
No reply content/headers.
578 f2d7b5ab Antony Chazapis
579 f2d7b5ab Antony Chazapis
===========================  ==============================
580 f2d7b5ab Antony Chazapis
Return Code                  Description
581 f2d7b5ab Antony Chazapis
===========================  ==============================
582 f2d7b5ab Antony Chazapis
201 (Created)                The object has been created
583 f2d7b5ab Antony Chazapis
===========================  ==============================
584 f2d7b5ab Antony Chazapis
585 f2d7b5ab Antony Chazapis
586 f2d7b5ab Antony Chazapis
MOVE
587 f2d7b5ab Antony Chazapis
""""
588 f2d7b5ab Antony Chazapis
589 cb146cf9 Antony Chazapis
Same as ``COPY``, without the ``X-Source-Version`` request header. The ``MOVE`` operation is always applied on the latest version.
590 f2d7b5ab Antony Chazapis
591 f2d7b5ab Antony Chazapis
592 f2d7b5ab Antony Chazapis
POST
593 f2d7b5ab Antony Chazapis
""""
594 f2d7b5ab Antony Chazapis
595 f2d7b5ab Antony Chazapis
====================  ================================
596 f2d7b5ab Antony Chazapis
Request Header Name   Value
597 f2d7b5ab Antony Chazapis
====================  ================================
598 e9285524 Antony Chazapis
Content-Length        The size of the data written (optional, to update)
599 e9285524 Antony Chazapis
Content-Type          The MIME content type of the object (optional, to update)
600 e9285524 Antony Chazapis
Content-Range         The range of data supplied (optional, to update)
601 e9285524 Antony Chazapis
Transfer-Encoding     Set to ``chunked`` to specify incremental uploading (if used, ``Content-Length`` is ignored)
602 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
603 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
604 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
605 cb146cf9 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional) (**TBD**)
606 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
607 f2d7b5ab Antony Chazapis
====================  ================================
608 f2d7b5ab Antony Chazapis
609 cb146cf9 Antony Chazapis
The ``Content-Encoding``, ``Content-Disposition``, ``X-Object-Manifest``, ``X-Object-Public`` (**TBD**) and ``X-Object-Meta-*`` headers are considered to be user defined metadata. The update operation will overwrite all previous values and remove any keys not supplied.
610 e9285524 Antony Chazapis
611 e9285524 Antony Chazapis
To update an object:
612 e9285524 Antony Chazapis
613 e9285524 Antony Chazapis
* Supply ``Content-Length`` (except if using chunked transfers), ``Content-Type`` and ``Content-Range`` headers.
614 e9285524 Antony Chazapis
* Set ``Content-Type`` to ``application/octet-stream``.
615 e9285524 Antony Chazapis
* Set ``Content-Range`` as specified in RFC2616, with the following differences:
616 e9285524 Antony Chazapis
617 e9285524 Antony Chazapis
  * Client software MAY omit ``last-byte-pos`` of if the length of the range being transferred is unknown or difficult to determine.
618 e9285524 Antony Chazapis
  * Client software SHOULD not specify the ``instance-length`` (use a ``*``), unless there is a reason for performing a size check at the server.
619 e9285524 Antony Chazapis
* If ``Content-Range`` used has a ``byte-range-resp-spec = *``, data supplied will be appended to the object.
620 e9285524 Antony Chazapis
621 e9285524 Antony Chazapis
A data update will trigger an ETag change. The new ETag will not correspond to the object's MD5 sum (**TBD**) and will be included in reply headers.
622 f2d7b5ab Antony Chazapis
623 e9285524 Antony Chazapis
No reply content. No reply headers if only metadata is updated.
624 e9285524 Antony Chazapis
625 e9285524 Antony Chazapis
==========================  ===============================
626 e9285524 Antony Chazapis
Reply Header Name           Value
627 e9285524 Antony Chazapis
==========================  ===============================
628 e9285524 Antony Chazapis
ETag                        The new ETag of the object (data updated)
629 e9285524 Antony Chazapis
==========================  ===============================
630 e9285524 Antony Chazapis
631 e9285524 Antony Chazapis
|
632 f2d7b5ab Antony Chazapis
633 f2d7b5ab Antony Chazapis
===========================  ==============================
634 f2d7b5ab Antony Chazapis
Return Code                  Description
635 f2d7b5ab Antony Chazapis
===========================  ==============================
636 e9285524 Antony Chazapis
202 (Accepted)               The request has been accepted (not a data update)
637 e9285524 Antony Chazapis
204 (No Content)             The request succeeded (data updated)
638 d8d07c08 Antony Chazapis
411 (Length Required)        Missing ``Content-Length`` in the request
639 cb146cf9 Antony Chazapis
416 (Range Not Satisfiable)  The supplied range is out of limits or invalid size
640 f2d7b5ab Antony Chazapis
===========================  ==============================
641 f2d7b5ab Antony Chazapis
642 f2d7b5ab Antony Chazapis
643 f2d7b5ab Antony Chazapis
DELETE
644 f2d7b5ab Antony Chazapis
""""""
645 f2d7b5ab Antony Chazapis
646 f2d7b5ab Antony Chazapis
No request parameters/headers.
647 f2d7b5ab Antony Chazapis
648 f2d7b5ab Antony Chazapis
No reply content/headers.
649 f2d7b5ab Antony Chazapis
650 f2d7b5ab Antony Chazapis
===========================  ==============================
651 f2d7b5ab Antony Chazapis
Return Code                  Description
652 f2d7b5ab Antony Chazapis
===========================  ==============================
653 f2d7b5ab Antony Chazapis
204 (No Content)             The request succeeded
654 f2d7b5ab Antony Chazapis
===========================  ==============================
655 f2d7b5ab Antony Chazapis
656 c9af0703 Antony Chazapis
Public Objects
657 c9af0703 Antony Chazapis
^^^^^^^^^^^^^^
658 c9af0703 Antony Chazapis
659 cb146cf9 Antony Chazapis
Objects that are marked as public, via the ``X-Object-Public`` meta (**TBD**), are also available at the corresponding URI ``https://hostname/public/<account>/<container>/<object>`` for ``HEAD`` or ``GET``. Requests for public objects do not need to include an ``X-Auth-Token``. Pithos will ignore request parameters and only include the following headers in the reply (all ``X-Object-*`` meta is hidden).
660 c9af0703 Antony Chazapis
661 c9af0703 Antony Chazapis
==========================  ===============================
662 c9af0703 Antony Chazapis
Reply Header Name           Value
663 c9af0703 Antony Chazapis
==========================  ===============================
664 c9af0703 Antony Chazapis
ETag                        The ETag of the object
665 c9af0703 Antony Chazapis
Content-Length              The size of the data returned
666 c9af0703 Antony Chazapis
Content-Type                The MIME content type of the object
667 c9af0703 Antony Chazapis
Content-Range               The range of data included (only on a single range request)
668 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
669 c9af0703 Antony Chazapis
Content-Encoding            The encoding of the object (optional)
670 c9af0703 Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
671 c9af0703 Antony Chazapis
==========================  ===============================
672 f2d7b5ab Antony Chazapis
673 f2d7b5ab Antony Chazapis
Summary
674 f2d7b5ab Antony Chazapis
^^^^^^^
675 f2d7b5ab Antony Chazapis
676 f2d7b5ab Antony Chazapis
List of differences from the OOS API:
677 f2d7b5ab Antony Chazapis
678 f2d7b5ab Antony Chazapis
* Support for ``X-Account-Meta-*`` style headers at the account level. Use ``POST`` to update.
679 f2d7b5ab Antony Chazapis
* Support for ``X-Container-Meta-*`` style headers at the account level. Can be set when creating via ``PUT``. Use ``POST`` to update.
680 f2d7b5ab Antony Chazapis
* Header ``X-Container-Object-Meta`` at the container level and parameter ``meta`` in container listings.
681 6bc372a4 Antony Chazapis
* Headers ``X-Container-Block-*`` at the container level, exposing the underlying storage characteristics.
682 f2d7b5ab Antony Chazapis
* All metadata replies, at all levels, include latest modification information.
683 f2d7b5ab Antony Chazapis
* At all levels, a ``GET`` request may use ``If-Modified-Since`` and ``If-Unmodified-Since`` headers.
684 f2d7b5ab Antony Chazapis
* Container/object lists include all associated metadata if the reply is of type json/xml. Some names are kept to their OOS API equivalents for compatibility. 
685 cb146cf9 Antony Chazapis
* Object metadata allowed, in addition to ``X-Object-Meta-*``: ``Content-Encoding``, ``Content-Disposition``, ``X-Object-Manifest``, ``X-Object-Public`` (**TBD**). These are all replaced with every update operation.
686 f2d7b5ab Antony Chazapis
* Multi-range object GET support as outlined in RFC2616.
687 e9285524 Antony Chazapis
* Object hashmap retrieval through GET and the ``format`` parameter.
688 e9285524 Antony Chazapis
* Partial object updates through POST, using the ``Content-Length``, ``Content-Type``, ``Content-Range`` and ``Transfer-Encoding`` headers.
689 f2d7b5ab Antony Chazapis
* Object ``MOVE`` support.
690 c9af0703 Antony Chazapis
* Time-variant account/container listings via the ``until`` parameter.
691 cb146cf9 Antony Chazapis
* Object versions - parameter ``version`` in HEAD/GET (list versions with GET), ``X-Object-Version-*`` meta in replies, ``X-Source-Version`` in PUT/COPY.
692 cb146cf9 Antony Chazapis
* Publicly accessible objects via ``https://hostname/public``. Control with ``X-Object-Public`` (**TBD**).
693 8cb45c13 Antony Chazapis
* Large object support with ``X-Object-Manifest``.
694 f2d7b5ab Antony Chazapis
695 f2d7b5ab Antony Chazapis
Clarifications/suggestions:
696 f2d7b5ab Antony Chazapis
697 f2d7b5ab Antony Chazapis
* Authentication is done by another system. The token is used in the same way, but it is obtained differently. The top level ``GET`` request is kept compatible with the OOS API and allows for guest/testing operations.
698 f2d7b5ab Antony Chazapis
* Some processing is done in the variable part of all ``X-*-Meta-*`` headers. If it includes underscores, they will be converted to dashes and the first letter of all intra-dash strings will be capitalized.
699 f2d7b5ab Antony Chazapis
* A ``GET`` reply for a level will include all headers of the corresponding ``HEAD`` request.
700 f2d7b5ab Antony Chazapis
* To avoid conflicts between objects and virtual directory markers in container listings, it is recommended that object names do not end with the delimiter used.
701 f2d7b5ab Antony Chazapis
* The ``Accept`` header may be used in requests instead of the ``format`` parameter to specify the desired reply format. The parameter overrides the header.
702 f2d7b5ab Antony Chazapis
* Container/object lists use a ``200`` return code if the reply is of type json/xml. The reply will include an empty json/xml.
703 f2d7b5ab Antony Chazapis
* In headers, dates are formatted according to RFC 1123. In extended information listings, dates are formatted according to ISO 8601.
704 c9af0703 Antony Chazapis
* The ``Last-Modified`` header value always reflects the actual latest change timestamp, regardless of time control parameters and version requests. Time precondition checks with ``If-Modified-Since`` and ``If-Unmodified-Since`` headers are applied to this value.
705 8cb45c13 Antony Chazapis
* A ``HEAD`` or ``GET`` for an ``X-Object-Manifest`` object, will include modified ``Content-Length`` and ``ETag`` headers, according to the characteristics of the objects under the specified prefix. The ``Etag`` will be the MD5 hash of the corresponding ETags concatenated. In extended container listings there is no metadata processing.
706 f2d7b5ab Antony Chazapis
707 f2d7b5ab Antony Chazapis
The Pithos Client
708 f2d7b5ab Antony Chazapis
-----------------
709 f2d7b5ab Antony Chazapis
710 f2d7b5ab Antony Chazapis
User Experience
711 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^
712 f2d7b5ab Antony Chazapis
713 f2d7b5ab Antony Chazapis
Hopefully this API will allow for a multitude of client implementations, each supporting a different device or operating system. All clients will be able to manipulate containers and objects - even software only designed for OOS API compatibility. But a Pithos interface should not be only about showing containers and folders. There are some extra user interface elements and functionalities that should be common to all implementations.
714 f2d7b5ab Antony Chazapis
715 f2d7b5ab Antony Chazapis
Upon entrance to the service, a user is presented with the following elements - which can be represented as folders or with other related icons:
716 f2d7b5ab Antony Chazapis
717 f2d7b5ab Antony Chazapis
* The ``home`` element, which is used as the default entry point to the user's "files". Objects under ``home`` are represented in the usual hierarchical organization of folders and files.
718 f2d7b5ab Antony Chazapis
* The ``trash`` element, which contains files that have been marked for deletion, but can still be recovered.
719 f2d7b5ab Antony Chazapis
* The ``shared`` element, which contains all objects shared by the user to other users of the system.
720 f2d7b5ab Antony Chazapis
* The ``others`` element, which contains all objects that other users share with the user.
721 f2d7b5ab Antony Chazapis
* The ``tags`` element, which lists the names of tags the user has defined. This can be an entry point to list all files that have been assigned a specific tag or manage tags in general (remove a tag completely, rename a tag etc.).
722 f2d7b5ab Antony Chazapis
* The ``groups`` element, which contains the names of groups the user has defined. Each group consists of a user list. Group creation, deletion, and manipulation is carried out by actions originating here.
723 f2d7b5ab Antony Chazapis
724 f2d7b5ab Antony Chazapis
Objects in Pithos can be:
725 f2d7b5ab Antony Chazapis
726 f2d7b5ab Antony Chazapis
* Assigned custom tags.
727 f2d7b5ab Antony Chazapis
* Moved to trash and then deleted.
728 f2d7b5ab Antony Chazapis
* Shared with specific permissions.
729 f2d7b5ab Antony Chazapis
* Made public (shared with non-Pithos users).
730 c9af0703 Antony Chazapis
* Restored from previous versions.
731 f2d7b5ab Antony Chazapis
732 f2d7b5ab Antony Chazapis
Some of these functions are performed by the client software and some by the Pithos server. Client-driven functionality is based on specific metadata that should be handled equally across implementations. These metadata names are discussed in the next chapter. 
733 f2d7b5ab Antony Chazapis
734 f2d7b5ab Antony Chazapis
Conventions and Metadata Specification
735 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
736 f2d7b5ab Antony Chazapis
737 f2d7b5ab Antony Chazapis
Pithos clients should use the ``pithos`` container for all Pithos objects. Object names use the ``/`` delimiter to impose a hierarchy of folders and files.
738 f2d7b5ab Antony Chazapis
739 f2d7b5ab Antony Chazapis
At the object level, tags are implemented by managing metadata keys. The client software should allow the user to use any string as a tag (except ``trash``) and then set the corresponding ``X-Object-Meta-<tag>`` key at the server. The API extensions provided, allow for listing all tags in a container and filtering object listings based on one or more tags. The tag list is sufficient for implementing the ``tags`` element, either as a special, virtual folder (as done in the first version of Pithos), or as an application menu.
740 f2d7b5ab Antony Chazapis
741 f2d7b5ab Antony Chazapis
To manage the deletion of files use the same API and the ``X-Object-Meta-Trash`` key. The string ``trash`` can not be used as a tag. The ``trash`` element should be presented as a folder, although with no hierarchy.
742 f2d7b5ab Antony Chazapis
743 f2d7b5ab Antony Chazapis
The metadata specification is summarized in the following table.
744 f2d7b5ab Antony Chazapis
745 f2d7b5ab Antony Chazapis
===========================  ==============================
746 f2d7b5ab Antony Chazapis
Metadata Name                Value
747 f2d7b5ab Antony Chazapis
===========================  ==============================
748 f2d7b5ab Antony Chazapis
X-Object-Meta-Trash          Set to ``true`` if the object has been moved to the trash
749 f2d7b5ab Antony Chazapis
X-Object-Meta-*              Use for other tags that apply to the object
750 f2d7b5ab Antony Chazapis
===========================  ==============================
751 288c1d55 Antony Chazapis
752 288c1d55 Antony Chazapis
Recommended Practices and Examples
753 288c1d55 Antony Chazapis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
754 288c1d55 Antony Chazapis
755 288c1d55 Antony Chazapis
Assuming an authentication token is obtained (**TBD**), the following high-level operations are available - shown with ``curl``:
756 288c1d55 Antony Chazapis
757 288c1d55 Antony Chazapis
* Get account information ::
758 288c1d55 Antony Chazapis
759 288c1d55 Antony Chazapis
    curl -X HEAD -D - \
760 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
761 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user
762 288c1d55 Antony Chazapis
763 288c1d55 Antony Chazapis
* List available containers ::
764 288c1d55 Antony Chazapis
765 288c1d55 Antony Chazapis
    curl -X GET -D - \
766 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
767 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user
768 288c1d55 Antony Chazapis
769 288c1d55 Antony Chazapis
* Get container information ::
770 288c1d55 Antony Chazapis
771 288c1d55 Antony Chazapis
    curl -X HEAD -D - \
772 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
773 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos
774 288c1d55 Antony Chazapis
775 288c1d55 Antony Chazapis
* Add a new container ::
776 288c1d55 Antony Chazapis
777 288c1d55 Antony Chazapis
    curl -X PUT -D - \
778 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
779 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/test
780 288c1d55 Antony Chazapis
781 288c1d55 Antony Chazapis
* Delete a container ::
782 288c1d55 Antony Chazapis
783 288c1d55 Antony Chazapis
    curl -X DELETE -D - \
784 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
785 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/test
786 288c1d55 Antony Chazapis
787 288c1d55 Antony Chazapis
* List objects in a container ::
788 288c1d55 Antony Chazapis
789 288c1d55 Antony Chazapis
    curl -X GET -D - \
790 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
791 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos
792 288c1d55 Antony Chazapis
793 288c1d55 Antony Chazapis
* List objects in a container (extended reply) ::
794 288c1d55 Antony Chazapis
795 288c1d55 Antony Chazapis
    curl -X GET -D - \
796 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
797 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos?format=json
798 288c1d55 Antony Chazapis
799 288c1d55 Antony Chazapis
* List metadata keys used by objects in a container
800 288c1d55 Antony Chazapis
801 288c1d55 Antony Chazapis
  Will be in the ``X-Container-Object-Meta`` reply header, included in container information or object list (``HEAD`` or ``GET``).
802 288c1d55 Antony Chazapis
803 288c1d55 Antony Chazapis
* List objects in a container having a specific meta defined ::
804 288c1d55 Antony Chazapis
805 288c1d55 Antony Chazapis
    curl -X GET -D - \
806 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
807 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos?meta=trash
808 288c1d55 Antony Chazapis
809 288c1d55 Antony Chazapis
  This is the recommended way of tagging/retrieving objects in trash.
810 288c1d55 Antony Chazapis
811 288c1d55 Antony Chazapis
* Retrieve an object ::
812 288c1d55 Antony Chazapis
813 288c1d55 Antony Chazapis
    curl -X GET -D - \
814 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
815 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/README.txt
816 288c1d55 Antony Chazapis
817 288c1d55 Antony Chazapis
* Retrieve an object (specific ranges of data) ::
818 288c1d55 Antony Chazapis
819 288c1d55 Antony Chazapis
    curl -X GET -D - \
820 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
821 288c1d55 Antony Chazapis
         -H "Range: bytes=0-9" \
822 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/README.txt
823 288c1d55 Antony Chazapis
824 288c1d55 Antony Chazapis
  This will return the first 10 bytes. To get the first 10, bytes 30-39 and the last 100 use ``Range: bytes=0-9,30-39,-100``.
825 288c1d55 Antony Chazapis
826 288c1d55 Antony Chazapis
* Add a new object (folder type) (**TBD**) ::
827 288c1d55 Antony Chazapis
828 288c1d55 Antony Chazapis
    curl -X PUT -D - \
829 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
830 288c1d55 Antony Chazapis
         -H "Content-Type: application/folder" \
831 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/folder
832 288c1d55 Antony Chazapis
833 288c1d55 Antony Chazapis
* Add a new object ::
834 288c1d55 Antony Chazapis
835 288c1d55 Antony Chazapis
    curl -X PUT -D - \
836 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
837 288c1d55 Antony Chazapis
         -H "Content-Type: text/plain" \
838 288c1d55 Antony Chazapis
         -T EXAMPLE.txt
839 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/folder/EXAMPLE.txt
840 288c1d55 Antony Chazapis
841 288c1d55 Antony Chazapis
* Update an object ::
842 288c1d55 Antony Chazapis
843 288c1d55 Antony Chazapis
    curl -X POST -D - \
844 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
845 288c1d55 Antony Chazapis
         -H "Content-Length: 10" \
846 288c1d55 Antony Chazapis
         -H "Content-Type: application/octet-stream" \
847 288c1d55 Antony Chazapis
         -H "Content-Range: bytes 10-19/*" \
848 288c1d55 Antony Chazapis
         -d "0123456789" \
849 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
850 288c1d55 Antony Chazapis
851 288c1d55 Antony Chazapis
  This will update bytes 10-19 with the data specified.
852 288c1d55 Antony Chazapis
853 288c1d55 Antony Chazapis
* Update an object (append) ::
854 288c1d55 Antony Chazapis
855 288c1d55 Antony Chazapis
    curl -X POST -D - \
856 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
857 288c1d55 Antony Chazapis
         -H "Content-Length: 10" \
858 288c1d55 Antony Chazapis
         -H "Content-Type: application/octet-stream" \
859 288c1d55 Antony Chazapis
         -H "Content-Range: bytes */*" \
860 288c1d55 Antony Chazapis
         -d "0123456789" \
861 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
862 288c1d55 Antony Chazapis
863 288c1d55 Antony Chazapis
* Add object metadata ::
864 288c1d55 Antony Chazapis
865 288c1d55 Antony Chazapis
    curl -X POST -D - \
866 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
867 288c1d55 Antony Chazapis
         -H "X-Object-Meta-First: first_meta_value" \
868 288c1d55 Antony Chazapis
         -H "X-Object-Meta-Second: second_meta_value" \
869 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
870 288c1d55 Antony Chazapis
871 288c1d55 Antony Chazapis
* Delete object metadata ::
872 288c1d55 Antony Chazapis
873 288c1d55 Antony Chazapis
    curl -X POST -D - \
874 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
875 288c1d55 Antony Chazapis
         -H "X-Object-Meta-First: first_meta_value" \
876 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
877 288c1d55 Antony Chazapis
878 288c1d55 Antony Chazapis
  Metadata can only be "set". To delete ``X-Object-Meta-Second``, reset all metadata.
879 288c1d55 Antony Chazapis
880 288c1d55 Antony Chazapis
* Delete an object ::
881 288c1d55 Antony Chazapis
882 288c1d55 Antony Chazapis
    curl -X DELETE -D - \
883 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
884 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt