Statistics
| Branch: | Tag: | Revision:

root / docs / source / devguide.rst @ b18ef3ad

History | View | Annotate | Download (54.5 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 3ab38c43 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. Pithos will store sharing permissions per object and enforce corresponding authorization policies. 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 f6c97079 Antony Chazapis
0.5 (July 19, 2011)        Object update from another object's data.
29 1495b972 Antony Chazapis
\                          Support object truncate.
30 1d5c57d3 Antony Chazapis
\                          Create object using a standard HTML form.
31 81f947fd Antony Chazapis
\                          Purge container/object history.
32 f6c97079 Antony Chazapis
\                          List other accounts that share objects with a user.
33 b18ef3ad Antony Chazapis
\                          List shared containers/objects.
34 7b0688a9 Sofia Papagiannaki
0.4 (July 01, 2011)        Object permissions and account groups.
35 3ab38c43 Antony Chazapis
\                          Control versioning behavior and container quotas with container policy directives.
36 3ab38c43 Antony Chazapis
\                          Support updating/deleting individual metadata with ``POST``.
37 7b0688a9 Sofia Papagiannaki
\                          Create object using hashmap.
38 8cb45c13 Antony Chazapis
0.3 (June 14, 2011)        Large object support with ``X-Object-Manifest``.
39 8cb45c13 Antony Chazapis
\                          Allow for publicly available objects via ``https://hostname/public``.
40 c9af0703 Antony Chazapis
\                          Support time-variant account/container listings. 
41 1d5c57d3 Antony Chazapis
\                          Add source version when duplicating with ``PUT``/``COPY``.
42 1d5c57d3 Antony Chazapis
\                          Request version in object ``HEAD``/``GET`` requests (list versions with ``GET``).
43 6bc372a4 Antony Chazapis
0.2 (May 31, 2011)         Add object meta listing and filtering in containers.
44 6bc372a4 Antony Chazapis
\                          Include underlying storage characteristics in container meta.
45 1d5c57d3 Antony Chazapis
\                          Support for partial object updates through ``POST``.
46 1d5c57d3 Antony Chazapis
\                          Expose object hashmaps through ``GET``.
47 1d5c57d3 Antony Chazapis
\                          Support for multi-range object ``GET`` requests.
48 f2d7b5ab Antony Chazapis
0.1 (May 17, 2011)         Initial release. Based on OpenStack Object Storage Developer Guide API v1 (Apr. 15, 2011).
49 f2d7b5ab Antony Chazapis
=========================  ================================
50 f2d7b5ab Antony Chazapis
51 f2d7b5ab Antony Chazapis
The Pithos API
52 f2d7b5ab Antony Chazapis
--------------
53 f2d7b5ab Antony Chazapis
54 c9af0703 Antony Chazapis
The URI requests supported by the Pithos API follow one of the following forms:
55 f2d7b5ab Antony Chazapis
56 f2d7b5ab Antony Chazapis
* Top level: ``https://hostname/v1/``
57 f2d7b5ab Antony Chazapis
* Account level: ``https://hostname/v1/<account>``
58 f2d7b5ab Antony Chazapis
* Container level: ``https://hostname/v1/<account>/<container>``
59 f2d7b5ab Antony Chazapis
* Object level: ``https://hostname/v1/<account>/<container>/<object>``
60 f2d7b5ab Antony Chazapis
61 81f947fd Antony Chazapis
All requests must include an ``X-Auth-Token`` - as a header, or a parameter. The process of obtaining the token is still to be determined (**TBD**).
62 f2d7b5ab Antony Chazapis
63 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.
64 f2d7b5ab Antony Chazapis
65 f2d7b5ab Antony Chazapis
=========================  ================================
66 f2d7b5ab Antony Chazapis
Return Code                Description
67 f2d7b5ab Antony Chazapis
=========================  ================================
68 f2d7b5ab Antony Chazapis
400 (Bad Request)          The request is invalid
69 f2d7b5ab Antony Chazapis
401 (Unauthorized)         Request not allowed
70 f2d7b5ab Antony Chazapis
404 (Not Found)            The requested resource was not found
71 f2d7b5ab Antony Chazapis
503 (Service Unavailable)  The request cannot be completed because of an internal error
72 f2d7b5ab Antony Chazapis
=========================  ================================
73 f2d7b5ab Antony Chazapis
74 f2d7b5ab Antony Chazapis
Top Level
75 f2d7b5ab Antony Chazapis
^^^^^^^^^
76 f2d7b5ab Antony Chazapis
77 f2d7b5ab Antony Chazapis
List of operations:
78 f2d7b5ab Antony Chazapis
79 f2d7b5ab Antony Chazapis
=========  ==================
80 f2d7b5ab Antony Chazapis
Operation  Description
81 f2d7b5ab Antony Chazapis
=========  ==================
82 f6c97079 Antony Chazapis
GET        Authentication (for compatibility with the OOS API) or list allowed accounts
83 f2d7b5ab Antony Chazapis
=========  ==================
84 f2d7b5ab Antony Chazapis
85 f2d7b5ab Antony Chazapis
GET
86 f2d7b5ab Antony Chazapis
"""
87 f2d7b5ab Antony Chazapis
88 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.
89 f2d7b5ab Antony Chazapis
90 f2d7b5ab Antony Chazapis
================  =====================
91 f2d7b5ab Antony Chazapis
Return Code       Description
92 f2d7b5ab Antony Chazapis
================  =====================
93 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
94 f2d7b5ab Antony Chazapis
================  =====================
95 f2d7b5ab Antony Chazapis
96 f6c97079 Antony Chazapis
If an ``X-Auth-Token`` is already present, the operation will be interpreted as a request to list other accounts that share objects to the user.
97 f6c97079 Antony Chazapis
98 f6c97079 Antony Chazapis
======================  =========================
99 f6c97079 Antony Chazapis
Request Parameter Name  Value
100 f6c97079 Antony Chazapis
======================  =========================
101 f6c97079 Antony Chazapis
limit                   The amount of results requested (default is 10000)
102 f6c97079 Antony Chazapis
marker                  Return containers with name lexicographically after marker
103 f6c97079 Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
104 f6c97079 Antony Chazapis
======================  =========================
105 f6c97079 Antony Chazapis
106 f6c97079 Antony Chazapis
The reply is a list of account names.
107 f6c97079 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.
108 f6c97079 Antony Chazapis
For each account, the information will include the following (names will be in lower case and with hyphens replaced with underscores):
109 f6c97079 Antony Chazapis
110 f6c97079 Antony Chazapis
===========================  ============================
111 f6c97079 Antony Chazapis
Name                         Description
112 f6c97079 Antony Chazapis
===========================  ============================
113 f6c97079 Antony Chazapis
name                         The name of the account
114 f6c97079 Antony Chazapis
last_modified                The last container modification date (regardless of ``until``)
115 f6c97079 Antony Chazapis
===========================  ============================
116 f6c97079 Antony Chazapis
117 f6c97079 Antony Chazapis
Example ``format=json`` reply:
118 f6c97079 Antony Chazapis
119 f6c97079 Antony Chazapis
::
120 f6c97079 Antony Chazapis
121 f6c97079 Antony Chazapis
  [{"name": "user", "last_modified": "2011-07-19T10:48:16"}, ...]
122 f6c97079 Antony Chazapis
123 f6c97079 Antony Chazapis
Example ``format=xml`` reply:
124 f6c97079 Antony Chazapis
125 f6c97079 Antony Chazapis
::
126 f6c97079 Antony Chazapis
127 f6c97079 Antony Chazapis
  <?xml version="1.0" encoding="UTF-8"?>
128 f6c97079 Antony Chazapis
  <accounts>
129 f6c97079 Antony Chazapis
    <account>
130 f6c97079 Antony Chazapis
      <name>user</name>
131 f6c97079 Antony Chazapis
      <last_modified>2011-07-19T10:48:16</last_modified>
132 f6c97079 Antony Chazapis
    </account>
133 f6c97079 Antony Chazapis
    <account>...</account>
134 f6c97079 Antony Chazapis
  </accounts>
135 f6c97079 Antony Chazapis
136 f6c97079 Antony Chazapis
===========================  =====================
137 f6c97079 Antony Chazapis
Return Code                  Description
138 f6c97079 Antony Chazapis
===========================  =====================
139 f6c97079 Antony Chazapis
200 (OK)                     The request succeeded
140 f6c97079 Antony Chazapis
204 (No Content)             The account has no containers (only for non-extended replies)
141 f6c97079 Antony Chazapis
===========================  =====================
142 f6c97079 Antony Chazapis
143 f6c97079 Antony Chazapis
Will use a ``200`` return code if the reply is of type json/xml.
144 f2d7b5ab Antony Chazapis
145 f2d7b5ab Antony Chazapis
Account Level
146 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^
147 f2d7b5ab Antony Chazapis
148 f2d7b5ab Antony Chazapis
List of operations:
149 f2d7b5ab Antony Chazapis
150 f2d7b5ab Antony Chazapis
=========  ==================
151 f2d7b5ab Antony Chazapis
Operation  Description
152 f2d7b5ab Antony Chazapis
=========  ==================
153 f2d7b5ab Antony Chazapis
HEAD       Retrieve account metadata
154 f2d7b5ab Antony Chazapis
GET        List containers
155 f2d7b5ab Antony Chazapis
POST       Update account metadata
156 f2d7b5ab Antony Chazapis
=========  ==================
157 f2d7b5ab Antony Chazapis
158 f2d7b5ab Antony Chazapis
HEAD
159 f2d7b5ab Antony Chazapis
""""
160 f2d7b5ab Antony Chazapis
161 c9af0703 Antony Chazapis
======================  ===================================
162 c9af0703 Antony Chazapis
Request Parameter Name  Value
163 c9af0703 Antony Chazapis
======================  ===================================
164 c9af0703 Antony Chazapis
until                   Optional timestamp
165 c9af0703 Antony Chazapis
======================  ===================================
166 c9af0703 Antony Chazapis
167 f6c97079 Antony Chazapis
Cross-user requests are not allowed to use ``until`` and only include the account modification date in the reply.
168 f2d7b5ab Antony Chazapis
169 f2d7b5ab Antony Chazapis
==========================  =====================
170 f2d7b5ab Antony Chazapis
Reply Header Name           Value
171 f2d7b5ab Antony Chazapis
==========================  =====================
172 f2d7b5ab Antony Chazapis
X-Account-Container-Count   The total number of containers
173 f2d7b5ab Antony Chazapis
X-Account-Object-Count      The total number of objects (**TBD**)
174 f2d7b5ab Antony Chazapis
X-Account-Bytes-Used        The total number of bytes stored
175 f2d7b5ab Antony Chazapis
X-Account-Bytes-Remaining   The total number of bytes remaining (**TBD**)
176 f2d7b5ab Antony Chazapis
X-Account-Last-Login        The last login (**TBD**)
177 c9af0703 Antony Chazapis
X-Account-Until-Timestamp   The last account modification date until the timestamp provided
178 3ab38c43 Antony Chazapis
X-Account-Group-*           Optional user defined groups
179 f2d7b5ab Antony Chazapis
X-Account-Meta-*            Optional user defined metadata
180 c9af0703 Antony Chazapis
Last-Modified               The last account modification date (regardless of ``until``)
181 f2d7b5ab Antony Chazapis
==========================  =====================
182 f2d7b5ab Antony Chazapis
183 f2d7b5ab Antony Chazapis
|
184 f2d7b5ab Antony Chazapis
185 f2d7b5ab Antony Chazapis
================  =====================
186 f2d7b5ab Antony Chazapis
Return Code       Description
187 f2d7b5ab Antony Chazapis
================  =====================
188 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
189 f2d7b5ab Antony Chazapis
================  =====================
190 f2d7b5ab Antony Chazapis
191 f2d7b5ab Antony Chazapis
192 f2d7b5ab Antony Chazapis
GET
193 f2d7b5ab Antony Chazapis
"""
194 f2d7b5ab Antony Chazapis
195 f2d7b5ab Antony Chazapis
====================  ===========================
196 f2d7b5ab Antony Chazapis
Request Header Name   Value
197 f2d7b5ab Antony Chazapis
====================  ===========================
198 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if account has changed since provided timestamp
199 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if account has not changed since provided timestamp
200 f2d7b5ab Antony Chazapis
====================  ===========================
201 f2d7b5ab Antony Chazapis
202 f2d7b5ab Antony Chazapis
|
203 f2d7b5ab Antony Chazapis
204 f2d7b5ab Antony Chazapis
======================  =========================
205 f2d7b5ab Antony Chazapis
Request Parameter Name  Value
206 f2d7b5ab Antony Chazapis
======================  =========================
207 f2d7b5ab Antony Chazapis
limit                   The amount of results requested (default is 10000)
208 f2d7b5ab Antony Chazapis
marker                  Return containers with name lexicographically after marker
209 f2d7b5ab Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
210 b18ef3ad Antony Chazapis
shared                  Show only shared containers (no value parameter)
211 c9af0703 Antony Chazapis
until                   Optional timestamp
212 f2d7b5ab Antony Chazapis
======================  =========================
213 f2d7b5ab Antony Chazapis
214 f2d7b5ab Antony Chazapis
The reply is a list of container names. Account headers (as in a ``HEAD`` request) will also be included.
215 f6c97079 Antony Chazapis
Cross-user requests are not allowed to use ``until`` and only include the account/container modification dates in the reply.
216 f6c97079 Antony Chazapis
217 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.
218 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):
219 f2d7b5ab Antony Chazapis
220 c9af0703 Antony Chazapis
===========================  ============================
221 c9af0703 Antony Chazapis
Name                         Description
222 c9af0703 Antony Chazapis
===========================  ============================
223 c9af0703 Antony Chazapis
name                         The name of the container
224 c9af0703 Antony Chazapis
count                        The number of objects inside the container
225 c9af0703 Antony Chazapis
bytes                        The total size of the objects inside the container
226 c9af0703 Antony Chazapis
last_modified                The last container modification date (regardless of ``until``)
227 c9af0703 Antony Chazapis
x_container_until_timestamp  The last container modification date until the timestamp provided
228 3ab38c43 Antony Chazapis
x_container_policy_*         Container behavior and limits
229 c9af0703 Antony Chazapis
x_container_meta_*           Optional user defined metadata
230 c9af0703 Antony Chazapis
===========================  ============================
231 f2d7b5ab Antony Chazapis
232 f2d7b5ab Antony Chazapis
For examples of container details returned in JSON/XML formats refer to the OOS API documentation.
233 f2d7b5ab Antony Chazapis
234 6bc372a4 Antony Chazapis
===========================  =====================
235 6bc372a4 Antony Chazapis
Return Code                  Description
236 6bc372a4 Antony Chazapis
===========================  =====================
237 6bc372a4 Antony Chazapis
200 (OK)                     The request succeeded
238 6bc372a4 Antony Chazapis
204 (No Content)             The account has no containers (only for non-extended replies)
239 6bc372a4 Antony Chazapis
304 (Not Modified)           The account has not been modified
240 6bc372a4 Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
241 6bc372a4 Antony Chazapis
===========================  =====================
242 f2d7b5ab Antony Chazapis
243 f2d7b5ab Antony Chazapis
Will use a ``200`` return code if the reply is of type json/xml.
244 f2d7b5ab Antony Chazapis
245 f2d7b5ab Antony Chazapis
246 f2d7b5ab Antony Chazapis
POST
247 f2d7b5ab Antony Chazapis
""""
248 f2d7b5ab Antony Chazapis
249 a6eb13e9 Antony Chazapis
======================  ============================================
250 a6eb13e9 Antony Chazapis
Request Parameter Name  Value
251 a6eb13e9 Antony Chazapis
======================  ============================================
252 3ab38c43 Antony Chazapis
update                  Do not replace metadata/groups (no value parameter)
253 a6eb13e9 Antony Chazapis
======================  ============================================
254 a6eb13e9 Antony Chazapis
255 a6eb13e9 Antony Chazapis
|
256 a6eb13e9 Antony Chazapis
257 f2d7b5ab Antony Chazapis
====================  ===========================
258 f2d7b5ab Antony Chazapis
Request Header Name   Value
259 f2d7b5ab Antony Chazapis
====================  ===========================
260 3ab38c43 Antony Chazapis
X-Account-Group-*     Optional user defined groups
261 f2d7b5ab Antony Chazapis
X-Account-Meta-*      Optional user defined metadata
262 f2d7b5ab Antony Chazapis
====================  ===========================
263 f2d7b5ab Antony Chazapis
264 f2d7b5ab Antony Chazapis
No reply content/headers.
265 f2d7b5ab Antony Chazapis
266 a6eb13e9 Antony Chazapis
The operation will overwrite all user defined metadata, except if ``update`` is defined.
267 3ab38c43 Antony Chazapis
To create a group, include an ``X-Account-Group-*`` header with the name in the key and a comma separated list of user names in the value. If no ``X-Account-Group-*`` header is present, no changes will be applied to groups. The ``update`` parameter also applies to groups. To delete a specific group, use ``update`` and an empty header value.
268 f2d7b5ab Antony Chazapis
269 f2d7b5ab Antony Chazapis
================  ===============================
270 f2d7b5ab Antony Chazapis
Return Code       Description
271 f2d7b5ab Antony Chazapis
================  ===============================
272 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
273 f2d7b5ab Antony Chazapis
================  ===============================
274 f2d7b5ab Antony Chazapis
275 f2d7b5ab Antony Chazapis
276 f2d7b5ab Antony Chazapis
Container Level
277 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^
278 f2d7b5ab Antony Chazapis
279 f2d7b5ab Antony Chazapis
List of operations:
280 f2d7b5ab Antony Chazapis
281 f2d7b5ab Antony Chazapis
=========  ============================
282 f2d7b5ab Antony Chazapis
Operation  Description
283 f2d7b5ab Antony Chazapis
=========  ============================
284 f2d7b5ab Antony Chazapis
HEAD       Retrieve container metadata
285 f2d7b5ab Antony Chazapis
GET        List objects
286 f2d7b5ab Antony Chazapis
PUT        Create/update container
287 f2d7b5ab Antony Chazapis
POST       Update container metadata
288 f2d7b5ab Antony Chazapis
DELETE     Delete container
289 f2d7b5ab Antony Chazapis
=========  ============================
290 f2d7b5ab Antony Chazapis
291 f2d7b5ab Antony Chazapis
292 f2d7b5ab Antony Chazapis
HEAD
293 f2d7b5ab Antony Chazapis
""""
294 f2d7b5ab Antony Chazapis
295 c9af0703 Antony Chazapis
======================  ===================================
296 c9af0703 Antony Chazapis
Request Parameter Name  Value
297 c9af0703 Antony Chazapis
======================  ===================================
298 c9af0703 Antony Chazapis
until                   Optional timestamp
299 c9af0703 Antony Chazapis
======================  ===================================
300 f2d7b5ab Antony Chazapis
301 f6c97079 Antony Chazapis
Cross-user requests are not allowed to use ``until`` and only include the container modification date in the reply.
302 c9af0703 Antony Chazapis
303 c9af0703 Antony Chazapis
===========================  ===============================
304 c9af0703 Antony Chazapis
Reply Header Name            Value
305 c9af0703 Antony Chazapis
===========================  ===============================
306 c9af0703 Antony Chazapis
X-Container-Object-Count     The total number of objects in the container
307 c9af0703 Antony Chazapis
X-Container-Bytes-Used       The total number of bytes of all objects stored
308 c9af0703 Antony Chazapis
X-Container-Block-Size       The block size used by the storage backend
309 c9af0703 Antony Chazapis
X-Container-Block-Hash       The hash algorithm used for block identifiers in object hashmaps
310 c9af0703 Antony Chazapis
X-Container-Until-Timestamp  The last container modification date until the timestamp provided
311 c9af0703 Antony Chazapis
X-Container-Object-Meta      A list with all meta keys used by objects
312 3ab38c43 Antony Chazapis
X-Container-Policy-*         Container behavior and limits
313 c9af0703 Antony Chazapis
X-Container-Meta-*           Optional user defined metadata
314 c9af0703 Antony Chazapis
Last-Modified                The last container modification date (regardless of ``until``)
315 c9af0703 Antony Chazapis
===========================  ===============================
316 f2d7b5ab Antony Chazapis
317 3ab38c43 Antony Chazapis
The keys returned in ``X-Container-Object-Meta`` are all the unique strings after the ``X-Object-Meta-`` prefix. See container ``PUT`` for a reference of policy directives.
318 f2d7b5ab Antony Chazapis
319 f2d7b5ab Antony Chazapis
================  ===============================
320 f2d7b5ab Antony Chazapis
Return Code       Description
321 f2d7b5ab Antony Chazapis
================  ===============================
322 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
323 f2d7b5ab Antony Chazapis
================  ===============================
324 f2d7b5ab Antony Chazapis
325 f2d7b5ab Antony Chazapis
326 f2d7b5ab Antony Chazapis
GET
327 f2d7b5ab Antony Chazapis
"""
328 f2d7b5ab Antony Chazapis
329 f2d7b5ab Antony Chazapis
====================  ===========================
330 f2d7b5ab Antony Chazapis
Request Header Name   Value
331 f2d7b5ab Antony Chazapis
====================  ===========================
332 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if container has changed since provided timestamp
333 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if container has not changed since provided timestamp
334 f2d7b5ab Antony Chazapis
====================  ===========================
335 f2d7b5ab Antony Chazapis
336 f2d7b5ab Antony Chazapis
|
337 f2d7b5ab Antony Chazapis
338 f2d7b5ab Antony Chazapis
======================  ===================================
339 f2d7b5ab Antony Chazapis
Request Parameter Name  Value
340 f2d7b5ab Antony Chazapis
======================  ===================================
341 f2d7b5ab Antony Chazapis
limit                   The amount of results requested (default is 10000)
342 f2d7b5ab Antony Chazapis
marker                  Return containers with name lexicographically after marker
343 f2d7b5ab Antony Chazapis
prefix                  Return objects starting with prefix
344 f2d7b5ab Antony Chazapis
delimiter               Return objects up to the delimiter (discussion follows)
345 f2d7b5ab Antony Chazapis
path                    Assume ``prefix=path`` and ``delimiter=/``
346 f2d7b5ab Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
347 f2d7b5ab Antony Chazapis
meta                    Return objects having the specified meta keys (can be a comma separated list)
348 b18ef3ad Antony Chazapis
shared                  Show only shared objects (no value parameter)
349 c9af0703 Antony Chazapis
until                   Optional timestamp
350 f2d7b5ab Antony Chazapis
======================  ===================================
351 f2d7b5ab Antony Chazapis
352 f2d7b5ab Antony Chazapis
The ``path`` parameter overrides ``prefix`` and ``delimiter``. When using ``path``, results will include objects ending in ``delimiter``.
353 f2d7b5ab Antony Chazapis
354 f2d7b5ab Antony Chazapis
The keys given with ``meta`` will be matched with the strings after the ``X-Object-Meta-`` prefix.
355 f2d7b5ab Antony Chazapis
356 f2d7b5ab Antony Chazapis
The reply is a list of object names. Container headers (as in a ``HEAD`` request) will also be included.
357 f6c97079 Antony Chazapis
Cross-user requests are not allowed to use ``until`` and include the following limited set of headers in the reply:
358 f6c97079 Antony Chazapis
359 f6c97079 Antony Chazapis
===========================  ===============================
360 f6c97079 Antony Chazapis
Reply Header Name            Value
361 f6c97079 Antony Chazapis
===========================  ===============================
362 f6c97079 Antony Chazapis
X-Container-Block-Size       The block size used by the storage backend
363 f6c97079 Antony Chazapis
X-Container-Block-Hash       The hash algorithm used for block identifiers in object hashmaps
364 f6c97079 Antony Chazapis
X-Container-Object-Meta      A list with all meta keys used by allowed objects (**TBD**)
365 f6c97079 Antony Chazapis
Last-Modified                The last container modification date
366 f6c97079 Antony Chazapis
===========================  ===============================
367 f6c97079 Antony Chazapis
368 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.
369 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):
370 f2d7b5ab Antony Chazapis
371 c9af0703 Antony Chazapis
==========================  ======================================
372 c9af0703 Antony Chazapis
Name                        Description
373 c9af0703 Antony Chazapis
==========================  ======================================
374 c9af0703 Antony Chazapis
name                        The name of the object
375 c9af0703 Antony Chazapis
hash                        The ETag of the object
376 c9af0703 Antony Chazapis
bytes                       The size of the object
377 c9af0703 Antony Chazapis
content_type                The MIME content type of the object
378 c9af0703 Antony Chazapis
content_encoding            The encoding of the object (optional)
379 c9af0703 Antony Chazapis
content-disposition         The presentation style of the object (optional)
380 c9af0703 Antony Chazapis
last_modified               The last object modification date (regardless of version)
381 c9af0703 Antony Chazapis
x_object_version            The object's version identifier
382 c9af0703 Antony Chazapis
x_object_version_timestamp  The object's version timestamp
383 104626e3 Antony Chazapis
x_object_modified_by        The user that committed the object's version
384 6d817842 Antony Chazapis
x_object_manifest           Object parts prefix in ``<container>/<object>`` form (optional)
385 3ab38c43 Antony Chazapis
x_object_sharing            Object permissions (optional)
386 3ab38c43 Antony Chazapis
x_object_shared_by          Object inheriting permissions (optional)
387 3ab38c43 Antony Chazapis
x_object_public             Object's publicly accessible URI (optional)
388 c9af0703 Antony Chazapis
x_object_meta_*             Optional user defined metadata
389 c9af0703 Antony Chazapis
==========================  ======================================
390 f2d7b5ab Antony Chazapis
391 f2d7b5ab Antony Chazapis
Extended replies may also include virtual directory markers in separate sections of the ``json`` or ``xml`` results.
392 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.
393 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="..." />``.
394 f2d7b5ab Antony Chazapis
In case there is an object with the same name as a virtual directory marker, the object will be returned.
395 c9af0703 Antony Chazapis
396 f2d7b5ab Antony Chazapis
For examples of object details returned in JSON/XML formats refer to the OOS API documentation.
397 f2d7b5ab Antony Chazapis
398 6bc372a4 Antony Chazapis
===========================  ===============================
399 6bc372a4 Antony Chazapis
Return Code                  Description
400 6bc372a4 Antony Chazapis
===========================  ===============================
401 6bc372a4 Antony Chazapis
200 (OK)                     The request succeeded
402 6bc372a4 Antony Chazapis
204 (No Content)             The account has no containers (only for non-extended replies)
403 6bc372a4 Antony Chazapis
304 (Not Modified)           The container has not been modified
404 6bc372a4 Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
405 6bc372a4 Antony Chazapis
===========================  ===============================
406 f2d7b5ab Antony Chazapis
407 f2d7b5ab Antony Chazapis
Will use a ``200`` return code if the reply is of type json/xml.
408 f2d7b5ab Antony Chazapis
409 f2d7b5ab Antony Chazapis
410 f2d7b5ab Antony Chazapis
PUT
411 f2d7b5ab Antony Chazapis
"""
412 f2d7b5ab Antony Chazapis
413 f2d7b5ab Antony Chazapis
====================  ================================
414 f2d7b5ab Antony Chazapis
Request Header Name   Value
415 f2d7b5ab Antony Chazapis
====================  ================================
416 3ab38c43 Antony Chazapis
X-Container-Policy-*  Container behavior and limits
417 f2d7b5ab Antony Chazapis
X-Container-Meta-*    Optional user defined metadata
418 f2d7b5ab Antony Chazapis
====================  ================================
419 f2d7b5ab Antony Chazapis
 
420 f2d7b5ab Antony Chazapis
No reply content/headers.
421 3ab38c43 Antony Chazapis
422 3ab38c43 Antony Chazapis
If no policy is defined, the container will be created with the default values.
423 3ab38c43 Antony Chazapis
Available policy directives:
424 3ab38c43 Antony Chazapis
425 3ab38c43 Antony Chazapis
* ``versioning``: Set to ``auto``, ``manual`` or ``none`` (default is ``manual``)
426 3ab38c43 Antony Chazapis
* ``quota``: Size limit in KB (default is ``0`` - unlimited)
427 f2d7b5ab Antony Chazapis
 
428 f2d7b5ab Antony Chazapis
================  ===============================
429 f2d7b5ab Antony Chazapis
Return Code       Description
430 f2d7b5ab Antony Chazapis
================  ===============================
431 f2d7b5ab Antony Chazapis
201 (Created)     The container has been created
432 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
433 f2d7b5ab Antony Chazapis
================  ===============================
434 f2d7b5ab Antony Chazapis
435 f2d7b5ab Antony Chazapis
436 f2d7b5ab Antony Chazapis
POST
437 f2d7b5ab Antony Chazapis
""""
438 f2d7b5ab Antony Chazapis
439 a6eb13e9 Antony Chazapis
======================  ============================================
440 a6eb13e9 Antony Chazapis
Request Parameter Name  Value
441 a6eb13e9 Antony Chazapis
======================  ============================================
442 3ab38c43 Antony Chazapis
update                  Do not replace metadata/policy (no value parameter)
443 a6eb13e9 Antony Chazapis
======================  ============================================
444 a6eb13e9 Antony Chazapis
445 a6eb13e9 Antony Chazapis
|
446 a6eb13e9 Antony Chazapis
447 f2d7b5ab Antony Chazapis
====================  ================================
448 f2d7b5ab Antony Chazapis
Request Header Name   Value
449 f2d7b5ab Antony Chazapis
====================  ================================
450 3ab38c43 Antony Chazapis
X-Container-Policy-*  Container behavior and limits
451 f2d7b5ab Antony Chazapis
X-Container-Meta-*    Optional user defined metadata
452 f2d7b5ab Antony Chazapis
====================  ================================
453 f2d7b5ab Antony Chazapis
454 f2d7b5ab Antony Chazapis
No reply content/headers.
455 f2d7b5ab Antony Chazapis
456 a6eb13e9 Antony Chazapis
The operation will overwrite all user defined metadata, except if ``update`` is defined.
457 3ab38c43 Antony Chazapis
To change policy, include an ``X-Container-Policy-*`` header with the name in the key. If no ``X-Container-Policy-*`` header is present, no changes will be applied to policy. The ``update`` parameter also applies to policy - deleted values will revert to defaults. To delete/revert a specific policy directive, use ``update`` and an empty header value. See container ``PUT`` for a reference of policy directives.
458 f2d7b5ab Antony Chazapis
459 f2d7b5ab Antony Chazapis
================  ===============================
460 f2d7b5ab Antony Chazapis
Return Code       Description
461 f2d7b5ab Antony Chazapis
================  ===============================
462 f2d7b5ab Antony Chazapis
202 (Accepted)    The request has been accepted
463 f2d7b5ab Antony Chazapis
================  ===============================
464 f2d7b5ab Antony Chazapis
465 f2d7b5ab Antony Chazapis
466 f2d7b5ab Antony Chazapis
DELETE
467 f2d7b5ab Antony Chazapis
""""""
468 f2d7b5ab Antony Chazapis
469 81f947fd Antony Chazapis
======================  ===================================
470 81f947fd Antony Chazapis
Request Parameter Name  Value
471 81f947fd Antony Chazapis
======================  ===================================
472 81f947fd Antony Chazapis
until                   Optional timestamp
473 81f947fd Antony Chazapis
======================  ===================================
474 81f947fd Antony Chazapis
475 81f947fd Antony Chazapis
If ``until`` is defined, the container is "purged" up to that time (the history of all objects up to then is deleted).
476 f2d7b5ab Antony Chazapis
477 f2d7b5ab Antony Chazapis
No reply content/headers.
478 f2d7b5ab Antony Chazapis
479 f2d7b5ab Antony Chazapis
================  ===============================
480 f2d7b5ab Antony Chazapis
Return Code       Description
481 f2d7b5ab Antony Chazapis
================  ===============================
482 f2d7b5ab Antony Chazapis
204 (No Content)  The request succeeded
483 f2d7b5ab Antony Chazapis
409 (Conflict)    The container is not empty
484 f2d7b5ab Antony Chazapis
================  ===============================
485 f2d7b5ab Antony Chazapis
486 f2d7b5ab Antony Chazapis
487 f2d7b5ab Antony Chazapis
Object Level
488 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^
489 f2d7b5ab Antony Chazapis
490 f2d7b5ab Antony Chazapis
List of operations:
491 f2d7b5ab Antony Chazapis
492 f2d7b5ab Antony Chazapis
=========  =================================
493 f2d7b5ab Antony Chazapis
Operation  Description
494 f2d7b5ab Antony Chazapis
=========  =================================
495 f2d7b5ab Antony Chazapis
HEAD       Retrieve object metadata
496 f2d7b5ab Antony Chazapis
GET        Read object data
497 f2d7b5ab Antony Chazapis
PUT        Write object data or copy/move object
498 f2d7b5ab Antony Chazapis
COPY       Copy object
499 f2d7b5ab Antony Chazapis
MOVE       Move object
500 6bc372a4 Antony Chazapis
POST       Update object metadata/data
501 f2d7b5ab Antony Chazapis
DELETE     Delete object
502 f2d7b5ab Antony Chazapis
=========  =================================
503 f2d7b5ab Antony Chazapis
504 f2d7b5ab Antony Chazapis
505 f2d7b5ab Antony Chazapis
HEAD
506 f2d7b5ab Antony Chazapis
""""
507 f2d7b5ab Antony Chazapis
508 c9af0703 Antony Chazapis
======================  ===================================
509 c9af0703 Antony Chazapis
Request Parameter Name  Value
510 c9af0703 Antony Chazapis
======================  ===================================
511 c9af0703 Antony Chazapis
version                 Optional version identifier
512 c9af0703 Antony Chazapis
======================  ===================================
513 c9af0703 Antony Chazapis
514 c9af0703 Antony Chazapis
|
515 f2d7b5ab Antony Chazapis
516 f2d7b5ab Antony Chazapis
==========================  ===============================
517 f2d7b5ab Antony Chazapis
Reply Header Name           Value
518 f2d7b5ab Antony Chazapis
==========================  ===============================
519 e9285524 Antony Chazapis
ETag                        The ETag of the object
520 f2d7b5ab Antony Chazapis
Content-Length              The size of the object
521 f2d7b5ab Antony Chazapis
Content-Type                The MIME content type of the object
522 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
523 f2d7b5ab Antony Chazapis
Content-Encoding            The encoding of the object (optional)
524 f2d7b5ab Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
525 c9af0703 Antony Chazapis
X-Object-Version            The object's version identifier
526 c9af0703 Antony Chazapis
X-Object-Version-Timestamp  The object's version timestamp
527 104626e3 Antony Chazapis
X-Object-Modified-By        The user that comitted the object's version
528 6d817842 Antony Chazapis
X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
529 3ab38c43 Antony Chazapis
X-Object-Sharing            Object permissions (optional)
530 3ab38c43 Antony Chazapis
X-Object-Shared-By          Object inheriting permissions (optional)
531 3ab38c43 Antony Chazapis
X-Object-Public             Object's publicly accessible URI (optional)
532 f2d7b5ab Antony Chazapis
X-Object-Meta-*             Optional user defined metadata
533 f2d7b5ab Antony Chazapis
==========================  ===============================
534 f2d7b5ab Antony Chazapis
535 f2d7b5ab Antony Chazapis
|
536 f2d7b5ab Antony Chazapis
537 f2d7b5ab Antony Chazapis
================  ===============================
538 f2d7b5ab Antony Chazapis
Return Code       Description
539 f2d7b5ab Antony Chazapis
================  ===============================
540 cb146cf9 Antony Chazapis
200 (No Content)  The request succeeded
541 f2d7b5ab Antony Chazapis
================  ===============================
542 f2d7b5ab Antony Chazapis
543 f2d7b5ab Antony Chazapis
544 f2d7b5ab Antony Chazapis
GET
545 f2d7b5ab Antony Chazapis
"""
546 f2d7b5ab Antony Chazapis
547 f2d7b5ab Antony Chazapis
====================  ================================
548 f2d7b5ab Antony Chazapis
Request Header Name   Value
549 f2d7b5ab Antony Chazapis
====================  ================================
550 f2d7b5ab Antony Chazapis
Range                 Optional range of data to retrieve
551 7b0688a9 Sofia Papagiannaki
If-Range              Retrieve the missing part if entity is unchanged; otherwise, retrieve the entire new entity (used together with Range header)
552 f2d7b5ab Antony Chazapis
If-Match              Retrieve if ETags match
553 f2d7b5ab Antony Chazapis
If-None-Match         Retrieve if ETags don't match
554 f2d7b5ab Antony Chazapis
If-Modified-Since     Retrieve if object has changed since provided timestamp
555 f2d7b5ab Antony Chazapis
If-Unmodified-Since   Retrieve if object has not changed since provided timestamp
556 f2d7b5ab Antony Chazapis
====================  ================================
557 f2d7b5ab Antony Chazapis
558 e9285524 Antony Chazapis
|
559 e9285524 Antony Chazapis
560 e9285524 Antony Chazapis
======================  ===================================
561 e9285524 Antony Chazapis
Request Parameter Name  Value
562 e9285524 Antony Chazapis
======================  ===================================
563 e9285524 Antony Chazapis
format                  Optional extended reply type (can be ``json`` or ``xml``)
564 c9af0703 Antony Chazapis
version                 Optional version identifier or ``list`` (specify a format if requesting a list)
565 e9285524 Antony Chazapis
======================  ===================================
566 e9285524 Antony Chazapis
567 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.
568 e9285524 Antony Chazapis
569 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.
570 e9285524 Antony Chazapis
571 e9285524 Antony Chazapis
Example ``format=json`` reply:
572 e9285524 Antony Chazapis
573 e9285524 Antony Chazapis
::
574 e9285524 Antony Chazapis
575 c9af0703 Antony Chazapis
  {"block_hash": "sha1", "hashes": ["7295c41da03d7f916440b98e32c4a2a39351546c", ...], "block_size": 131072, "bytes": 242}
576 e9285524 Antony Chazapis
577 e9285524 Antony Chazapis
Example ``format=xml`` reply:
578 e9285524 Antony Chazapis
579 e9285524 Antony Chazapis
::
580 e9285524 Antony Chazapis
581 e9285524 Antony Chazapis
  <?xml version="1.0" encoding="UTF-8"?>
582 6bc372a4 Antony Chazapis
  <object name="file" bytes="24223726" block_size="131072" block_hash="sha1">
583 e9285524 Antony Chazapis
    <hash>7295c41da03d7f916440b98e32c4a2a39351546c</hash>
584 e9285524 Antony Chazapis
    <hash>...</hash>
585 e9285524 Antony Chazapis
  </object>
586 f2d7b5ab Antony Chazapis
587 104626e3 Antony Chazapis
Version lists include the version identifier and timestamp for each available object version. Version identifiers can be arbitrary strings, so use the timestamp to find newer versions.
588 c9af0703 Antony Chazapis
589 c9af0703 Antony Chazapis
Example ``format=json`` reply:
590 c9af0703 Antony Chazapis
591 c9af0703 Antony Chazapis
::
592 c9af0703 Antony Chazapis
593 c9af0703 Antony Chazapis
  {"versions": [[23, 1307700892], [28, 1307700898], ...]}
594 c9af0703 Antony Chazapis
595 c9af0703 Antony Chazapis
Example ``format=xml`` reply:
596 c9af0703 Antony Chazapis
597 c9af0703 Antony Chazapis
::
598 c9af0703 Antony Chazapis
599 c9af0703 Antony Chazapis
  <?xml version="1.0" encoding="UTF-8"?>
600 c9af0703 Antony Chazapis
  <object name="file">
601 c9af0703 Antony Chazapis
    <version timestamp="1307700892">23</version>
602 c9af0703 Antony Chazapis
    <version timestamp="1307700898">28</version>
603 c9af0703 Antony Chazapis
    <version timestamp="...">...</version>
604 c9af0703 Antony Chazapis
  </object>
605 c9af0703 Antony Chazapis
606 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.
607 f2d7b5ab Antony Chazapis
608 f2d7b5ab Antony Chazapis
==========================  ===============================
609 f2d7b5ab Antony Chazapis
Reply Header Name           Value
610 f2d7b5ab Antony Chazapis
==========================  ===============================
611 e9285524 Antony Chazapis
ETag                        The ETag of the object
612 f2d7b5ab Antony Chazapis
Content-Length              The size of the data returned
613 f2d7b5ab Antony Chazapis
Content-Type                The MIME content type of the object
614 f2d7b5ab Antony Chazapis
Content-Range               The range of data included (only on a single range request)
615 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
616 f2d7b5ab Antony Chazapis
Content-Encoding            The encoding of the object (optional)
617 f2d7b5ab Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
618 c9af0703 Antony Chazapis
X-Object-Version            The object's version identifier
619 c9af0703 Antony Chazapis
X-Object-Version-Timestamp  The object's version timestamp
620 104626e3 Antony Chazapis
X-Object-Modified-By        The user that comitted the object's version
621 6d817842 Antony Chazapis
X-Object-Manifest           Object parts prefix in ``<container>/<object>`` form (optional)
622 3ab38c43 Antony Chazapis
X-Object-Sharing            Object permissions (optional)
623 3ab38c43 Antony Chazapis
X-Object-Shared-By          Object inheriting permissions (optional)
624 3ab38c43 Antony Chazapis
X-Object-Public             Object's publicly accessible URI (optional)
625 f2d7b5ab Antony Chazapis
X-Object-Meta-*             Optional user defined metadata
626 f2d7b5ab Antony Chazapis
==========================  ===============================
627 f2d7b5ab Antony Chazapis
628 f2d7b5ab Antony Chazapis
|
629 f2d7b5ab Antony Chazapis
630 f2d7b5ab Antony Chazapis
===========================  ==============================
631 f2d7b5ab Antony Chazapis
Return Code                  Description
632 f2d7b5ab Antony Chazapis
===========================  ==============================
633 f2d7b5ab Antony Chazapis
200 (OK)                     The request succeeded
634 f2d7b5ab Antony Chazapis
206 (Partial Content)        The range request succeeded
635 f2d7b5ab Antony Chazapis
304 (Not Modified)           The object has not been modified
636 f2d7b5ab Antony Chazapis
412 (Precondition Failed)    The condition set can not be satisfied
637 f2d7b5ab Antony Chazapis
416 (Range Not Satisfiable)  The requested range is out of limits
638 f2d7b5ab Antony Chazapis
===========================  ==============================
639 f2d7b5ab Antony Chazapis
640 f2d7b5ab Antony Chazapis
641 f2d7b5ab Antony Chazapis
PUT
642 f2d7b5ab Antony Chazapis
"""
643 f2d7b5ab Antony Chazapis
644 f2d7b5ab Antony Chazapis
====================  ================================
645 f2d7b5ab Antony Chazapis
Request Header Name   Value
646 f2d7b5ab Antony Chazapis
====================  ================================
647 f2d7b5ab Antony Chazapis
ETag                  The MD5 hash of the object (optional to check written data)
648 f2d7b5ab Antony Chazapis
Content-Length        The size of the data written
649 f2d7b5ab Antony Chazapis
Content-Type          The MIME content type of the object
650 f2d7b5ab Antony Chazapis
Transfer-Encoding     Set to ``chunked`` to specify incremental uploading (if used, ``Content-Length`` is ignored)
651 f2d7b5ab Antony Chazapis
X-Copy-From           The source path in the form ``/<container>/<object>``
652 f2d7b5ab Antony Chazapis
X-Move-From           The source path in the form ``/<container>/<object>``
653 cb146cf9 Antony Chazapis
X-Source-Version      The source version to copy from
654 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
655 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
656 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
657 3ab38c43 Antony Chazapis
X-Object-Sharing      Object permissions (optional)
658 3ab38c43 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional)
659 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
660 f2d7b5ab Antony Chazapis
====================  ================================
661 f2d7b5ab Antony Chazapis
662 f2d7b5ab Antony Chazapis
|
663 f2d7b5ab Antony Chazapis
664 7b0688a9 Sofia Papagiannaki
======================  ===================================
665 7b0688a9 Sofia Papagiannaki
Request Parameter Name  Value
666 7b0688a9 Sofia Papagiannaki
======================  ===================================
667 7b0688a9 Sofia Papagiannaki
format                  Optional extended request type (can be ``json``) to create the object by suppling its hashmap instead
668 7b0688a9 Sofia Papagiannaki
======================  ===================================
669 7b0688a9 Sofia Papagiannaki
670 1d5c57d3 Antony Chazapis
The request is the object's data (or part of it), except if a hashmap is provided with the ``format`` parameter.  If format is used and all different parts are stored in the server, the object is created, otherwise the server returns Conflict (409) with the list of the missing parts. 
671 7b0688a9 Sofia Papagiannaki
672 7b0688a9 Sofia Papagiannaki
Hashmaps expose the underlying storage format of the object.
673 7b0688a9 Sofia Papagiannaki
674 7b0688a9 Sofia Papagiannaki
Example ``format=json`` request:
675 7b0688a9 Sofia Papagiannaki
676 7b0688a9 Sofia Papagiannaki
::
677 7b0688a9 Sofia Papagiannaki
678 7b0688a9 Sofia Papagiannaki
  {"block_hash": "sha1", "hashes": ["7295c41da03d7f916440b98e32c4a2a39351546c", ...], "block_size": 131072, "bytes": 242}
679 7b0688a9 Sofia Papagiannaki
680 32a437b1 Sofia Papagiannaki
Example ``format=xml`` request:
681 32a437b1 Sofia Papagiannaki
682 32a437b1 Sofia Papagiannaki
::
683 32a437b1 Sofia Papagiannaki
684 32a437b1 Sofia Papagiannaki
  <?xml version="1.0" encoding="UTF-8"?>
685 32a437b1 Sofia Papagiannaki
  <object name="file" bytes="24223726" block_size="131072" block_hash="sha1">
686 32a437b1 Sofia Papagiannaki
    <hash>7295c41da03d7f916440b98e32c4a2a39351546c</hash>
687 32a437b1 Sofia Papagiannaki
    <hash>...</hash>
688 32a437b1 Sofia Papagiannaki
  </object>
689 7b0688a9 Sofia Papagiannaki
690 f2d7b5ab Antony Chazapis
==========================  ===============================
691 f2d7b5ab Antony Chazapis
Reply Header Name           Value
692 f2d7b5ab Antony Chazapis
==========================  ===============================
693 f2d7b5ab Antony Chazapis
ETag                        The MD5 hash of the object (on create)
694 f2d7b5ab Antony Chazapis
==========================  ===============================
695 f2d7b5ab Antony Chazapis
696 b0a2d1a6 Antony Chazapis
The ``X-Object-Sharing`` header may include either a ``read=...`` comma-separated user/group list, or a ``write=...`` comma-separated user/group list, or both separated by a semicolon (``;``). Groups are specified as ``<account>:<group>``. To publish the object, set ``X-Object-Public`` to ``true``. To unpublish, set to ``false``, or use an empty header value.
697 f2d7b5ab Antony Chazapis
698 f2d7b5ab Antony Chazapis
===========================  ==============================
699 f2d7b5ab Antony Chazapis
Return Code                  Description
700 f2d7b5ab Antony Chazapis
===========================  ==============================
701 f2d7b5ab Antony Chazapis
201 (Created)                The object has been created
702 1993fea9 Antony Chazapis
409 (Conflict)               The object can not be created from the provided hashmap, or there are conflicting permissions (a list of missing hashes, or a conflicting sharing path will be included in the reply - in JSON format)
703 f2d7b5ab Antony Chazapis
411 (Length Required)        Missing ``Content-Length`` or ``Content-Type`` in the request
704 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
705 f2d7b5ab Antony Chazapis
===========================  ==============================
706 f2d7b5ab Antony Chazapis
707 f2d7b5ab Antony Chazapis
708 f2d7b5ab Antony Chazapis
COPY
709 f2d7b5ab Antony Chazapis
""""
710 f2d7b5ab Antony Chazapis
711 f2d7b5ab Antony Chazapis
====================  ================================
712 f2d7b5ab Antony Chazapis
Request Header Name   Value
713 f2d7b5ab Antony Chazapis
====================  ================================
714 f2d7b5ab Antony Chazapis
Destination           The destination path in the form ``/<container>/<object>``
715 f2d7b5ab Antony Chazapis
Content-Type          The MIME content type of the object (optional)
716 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
717 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
718 cb146cf9 Antony Chazapis
X-Source-Version      The source version to copy from
719 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
720 3ab38c43 Antony Chazapis
X-Object-Sharing      Object permissions (optional)
721 3ab38c43 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional)
722 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
723 f2d7b5ab Antony Chazapis
====================  ================================
724 f2d7b5ab Antony Chazapis
725 3ab38c43 Antony Chazapis
Refer to ``PUT``/``POST`` for a description of request headers. Metadata is also copied, updated with any values defined. Sharing/publishing options are not copied.
726 a6eb13e9 Antony Chazapis
727 f2d7b5ab Antony Chazapis
No reply content/headers.
728 f2d7b5ab Antony Chazapis
729 f2d7b5ab Antony Chazapis
===========================  ==============================
730 f2d7b5ab Antony Chazapis
Return Code                  Description
731 f2d7b5ab Antony Chazapis
===========================  ==============================
732 f2d7b5ab Antony Chazapis
201 (Created)                The object has been created
733 1993fea9 Antony Chazapis
409 (Conflict)               There are conflicting permissions (a conflicting sharing path will be included in the reply - in JSON format)
734 f2d7b5ab Antony Chazapis
===========================  ==============================
735 f2d7b5ab Antony Chazapis
736 f2d7b5ab Antony Chazapis
737 f2d7b5ab Antony Chazapis
MOVE
738 f2d7b5ab Antony Chazapis
""""
739 f2d7b5ab Antony Chazapis
740 cb146cf9 Antony Chazapis
Same as ``COPY``, without the ``X-Source-Version`` request header. The ``MOVE`` operation is always applied on the latest version.
741 f2d7b5ab Antony Chazapis
742 f2d7b5ab Antony Chazapis
743 f2d7b5ab Antony Chazapis
POST
744 f2d7b5ab Antony Chazapis
""""
745 f2d7b5ab Antony Chazapis
746 a6eb13e9 Antony Chazapis
======================  ============================================
747 a6eb13e9 Antony Chazapis
Request Parameter Name  Value
748 a6eb13e9 Antony Chazapis
======================  ============================================
749 a6eb13e9 Antony Chazapis
update                  Do not replace metadata (no value parameter)
750 a6eb13e9 Antony Chazapis
======================  ============================================
751 a6eb13e9 Antony Chazapis
752 a6eb13e9 Antony Chazapis
|
753 a6eb13e9 Antony Chazapis
754 f2d7b5ab Antony Chazapis
====================  ================================
755 f2d7b5ab Antony Chazapis
Request Header Name   Value
756 f2d7b5ab Antony Chazapis
====================  ================================
757 e9285524 Antony Chazapis
Content-Length        The size of the data written (optional, to update)
758 e9285524 Antony Chazapis
Content-Type          The MIME content type of the object (optional, to update)
759 e9285524 Antony Chazapis
Content-Range         The range of data supplied (optional, to update)
760 e9285524 Antony Chazapis
Transfer-Encoding     Set to ``chunked`` to specify incremental uploading (if used, ``Content-Length`` is ignored)
761 f2d7b5ab Antony Chazapis
Content-Encoding      The encoding of the object (optional)
762 f2d7b5ab Antony Chazapis
Content-Disposition   The presentation style of the object (optional)
763 ab2e317e Antony Chazapis
X-Source-Object       Update with data from the object at path ``/<container>/<object>`` (optional, to update)
764 ab2e317e Antony Chazapis
X-Source-Version      The source version to update from (optional, to update)
765 1495b972 Antony Chazapis
X-Object-Bytes        The updated object's final size (optional, when updating)
766 6d817842 Antony Chazapis
X-Object-Manifest     Object parts prefix in ``<container>/<object>`` form (optional)
767 3ab38c43 Antony Chazapis
X-Object-Sharing      Object permissions (optional)
768 3ab38c43 Antony Chazapis
X-Object-Public       Object is publicly accessible (optional)
769 f2d7b5ab Antony Chazapis
X-Object-Meta-*       Optional user defined metadata
770 f2d7b5ab Antony Chazapis
====================  ================================
771 f2d7b5ab Antony Chazapis
772 3ab38c43 Antony Chazapis
The ``Content-Encoding``, ``Content-Disposition``, ``X-Object-Manifest`` and ``X-Object-Meta-*`` headers are considered to be user defined metadata. An operation without the ``update`` parameter will overwrite all previous values and remove any keys not supplied. When using ``update`` any metadata with an empty value will be deleted.
773 3ab38c43 Antony Chazapis
774 3ab38c43 Antony Chazapis
To change permissions, include an ``X-Object-Sharing`` header (as defined in ``PUT``). To publish, include an ``X-Object-Public`` header, with a value of ``true``. If no such headers are defined, no changes will be applied to sharing/public. Use empty values to remove permissions/unpublish (unpublishing also works with ``false`` as a header value). Sharing options are applied to the object - not its versions.
775 e9285524 Antony Chazapis
776 a6eb13e9 Antony Chazapis
To update an object's data:
777 e9285524 Antony Chazapis
778 ab2e317e Antony Chazapis
* Either set ``Content-Type`` to ``application/octet-stream``, or provide an object with ``X-Source-Object``. If ``Content-Type`` has some other value, it will be ignored and only the metadata will be updated.
779 ab2e317e Antony Chazapis
* If the data is supplied in the request (using ``Content-Type`` instead of ``X-Source-Object``), a valid ``Content-Length`` header is required - except if using chunked transfers (set ``Transfer-Encoding`` to ``chunked``).
780 e9285524 Antony Chazapis
* Set ``Content-Range`` as specified in RFC2616, with the following differences:
781 e9285524 Antony Chazapis
782 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.
783 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.
784 ab2e317e Antony Chazapis
* If ``Content-Range`` used has a ``byte-range-resp-spec = *``, data will be appended to the object.
785 e9285524 Antony Chazapis
786 1495b972 Antony Chazapis
Optionally, truncate the updated object to the desired length with the ``X-Object-Bytes`` header.
787 1495b972 Antony Chazapis
788 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.
789 f2d7b5ab Antony Chazapis
790 e9285524 Antony Chazapis
No reply content. No reply headers if only metadata is updated.
791 e9285524 Antony Chazapis
792 e9285524 Antony Chazapis
==========================  ===============================
793 e9285524 Antony Chazapis
Reply Header Name           Value
794 e9285524 Antony Chazapis
==========================  ===============================
795 e9285524 Antony Chazapis
ETag                        The new ETag of the object (data updated)
796 e9285524 Antony Chazapis
==========================  ===============================
797 e9285524 Antony Chazapis
798 e9285524 Antony Chazapis
|
799 f2d7b5ab Antony Chazapis
800 f2d7b5ab Antony Chazapis
===========================  ==============================
801 f2d7b5ab Antony Chazapis
Return Code                  Description
802 f2d7b5ab Antony Chazapis
===========================  ==============================
803 e9285524 Antony Chazapis
202 (Accepted)               The request has been accepted (not a data update)
804 e9285524 Antony Chazapis
204 (No Content)             The request succeeded (data updated)
805 1993fea9 Antony Chazapis
409 (Conflict)               There are conflicting permissions (a conflicting sharing path will be included in the reply - in JSON format)
806 d8d07c08 Antony Chazapis
411 (Length Required)        Missing ``Content-Length`` in the request
807 a6eb13e9 Antony Chazapis
416 (Range Not Satisfiable)  The supplied range is invalid
808 f2d7b5ab Antony Chazapis
===========================  ==============================
809 f2d7b5ab Antony Chazapis
810 1d5c57d3 Antony Chazapis
The ``POST`` method can also be used for creating an object via a standard HTML form. If the request ``Content-Type`` is ``multipart/form-data``, none of the above headers will be processed. The form should have exactly two fields, as in the following example. ::
811 1d5c57d3 Antony Chazapis
812 1d5c57d3 Antony Chazapis
  <form method="post" action="https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt" enctype="multipart/form-data">
813 1d5c57d3 Antony Chazapis
    <input type="hidden" name="X-Auth-Token" value="0000">
814 1d5c57d3 Antony Chazapis
    <input type="file" name="X-Object-Data">
815 1d5c57d3 Antony Chazapis
    <input type="submit">
816 1d5c57d3 Antony Chazapis
  </form>
817 1d5c57d3 Antony Chazapis
818 1d5c57d3 Antony Chazapis
This will create/override the object with the given name, as if using ``PUT``. The ``Content-Type`` of the object will be set to the value of the corresponding header sent in the part of the request containing the data. Metadata, sharing and other object attributes can not be set this way.
819 1d5c57d3 Antony Chazapis
820 1d5c57d3 Antony Chazapis
==========================  ===============================
821 1d5c57d3 Antony Chazapis
Reply Header Name           Value
822 1d5c57d3 Antony Chazapis
==========================  ===============================
823 1d5c57d3 Antony Chazapis
ETag                        The MD5 hash of the object
824 1d5c57d3 Antony Chazapis
==========================  ===============================
825 1d5c57d3 Antony Chazapis
826 1d5c57d3 Antony Chazapis
|
827 1d5c57d3 Antony Chazapis
828 1d5c57d3 Antony Chazapis
===========================  ==============================
829 1d5c57d3 Antony Chazapis
Return Code                  Description
830 1d5c57d3 Antony Chazapis
===========================  ==============================
831 1d5c57d3 Antony Chazapis
201 (Created)                The object has been created
832 1d5c57d3 Antony Chazapis
===========================  ==============================
833 1d5c57d3 Antony Chazapis
834 f2d7b5ab Antony Chazapis
835 f2d7b5ab Antony Chazapis
DELETE
836 f2d7b5ab Antony Chazapis
""""""
837 f2d7b5ab Antony Chazapis
838 81f947fd Antony Chazapis
======================  ===================================
839 81f947fd Antony Chazapis
Request Parameter Name  Value
840 81f947fd Antony Chazapis
======================  ===================================
841 81f947fd Antony Chazapis
until                   Optional timestamp
842 81f947fd Antony Chazapis
======================  ===================================
843 81f947fd Antony Chazapis
844 81f947fd Antony Chazapis
If ``until`` is defined, the object is "purged" up to that time (the history up to then is deleted).
845 f2d7b5ab Antony Chazapis
846 f2d7b5ab Antony Chazapis
No reply content/headers.
847 f2d7b5ab Antony Chazapis
848 f2d7b5ab Antony Chazapis
===========================  ==============================
849 f2d7b5ab Antony Chazapis
Return Code                  Description
850 f2d7b5ab Antony Chazapis
===========================  ==============================
851 f2d7b5ab Antony Chazapis
204 (No Content)             The request succeeded
852 f2d7b5ab Antony Chazapis
===========================  ==============================
853 f2d7b5ab Antony Chazapis
854 3ab38c43 Antony Chazapis
Sharing and Public Objects
855 3ab38c43 Antony Chazapis
^^^^^^^^^^^^^^^^^^^^^^^^^^
856 3ab38c43 Antony Chazapis
857 3ab38c43 Antony Chazapis
Read and write control in Pithos is managed by setting appropriate permissions with the ``X-Object-Sharing`` header. The permissions are applied using prefix-based inheritance. Thus, each set of authorization directives is applied to all objects sharing the same prefix with the object where the corresponding ``X-Object-Sharing`` header is defined. For simplicity, nested/overlapping permissions are not allowed. Setting ``X-Object-Sharing`` will fail, if the object is already "covered", or another object with a longer common-prefix name already has permissions. When retrieving an object, the ``X-Object-Shared-By`` header reports where it gets its permissions from. If not present, the object is the actual source of authorization directives.
858 c9af0703 Antony Chazapis
859 f6c97079 Antony Chazapis
A user may ``GET`` another account or container. The result will include a limited reply, containing only the allowed containers or objects respectively. A top-level request with an authentication token, will return a list of allowed accounts, so the user can easily find out which other users share objects.
860 f6c97079 Antony Chazapis
861 f6c97079 Antony Chazapis
Objects that are marked as public, via the ``X-Object-Public`` meta, are also available at the corresponding URI returned 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):
862 c9af0703 Antony Chazapis
863 c9af0703 Antony Chazapis
==========================  ===============================
864 c9af0703 Antony Chazapis
Reply Header Name           Value
865 c9af0703 Antony Chazapis
==========================  ===============================
866 c9af0703 Antony Chazapis
ETag                        The ETag of the object
867 c9af0703 Antony Chazapis
Content-Length              The size of the data returned
868 c9af0703 Antony Chazapis
Content-Type                The MIME content type of the object
869 c9af0703 Antony Chazapis
Content-Range               The range of data included (only on a single range request)
870 c9af0703 Antony Chazapis
Last-Modified               The last object modification date (regardless of version)
871 c9af0703 Antony Chazapis
Content-Encoding            The encoding of the object (optional)
872 c9af0703 Antony Chazapis
Content-Disposition         The presentation style of the object (optional)
873 c9af0703 Antony Chazapis
==========================  ===============================
874 f2d7b5ab Antony Chazapis
875 f6c97079 Antony Chazapis
Public objects are not included and do not influence cross-user listings. They are, however, readable by all users.
876 f6c97079 Antony Chazapis
877 f2d7b5ab Antony Chazapis
Summary
878 f2d7b5ab Antony Chazapis
^^^^^^^
879 f2d7b5ab Antony Chazapis
880 f2d7b5ab Antony Chazapis
List of differences from the OOS API:
881 f2d7b5ab Antony Chazapis
882 f2d7b5ab Antony Chazapis
* Support for ``X-Account-Meta-*`` style headers at the account level. Use ``POST`` to update.
883 3ab38c43 Antony Chazapis
* Support for ``X-Container-Meta-*`` style headers at the container level. Can be set when creating via ``PUT``. Use ``POST`` to update.
884 f2d7b5ab Antony Chazapis
* Header ``X-Container-Object-Meta`` at the container level and parameter ``meta`` in container listings.
885 3ab38c43 Antony Chazapis
* Container policies to manage behavior and limits.
886 6bc372a4 Antony Chazapis
* Headers ``X-Container-Block-*`` at the container level, exposing the underlying storage characteristics.
887 f2d7b5ab Antony Chazapis
* All metadata replies, at all levels, include latest modification information.
888 f2d7b5ab Antony Chazapis
* At all levels, a ``GET`` request may use ``If-Modified-Since`` and ``If-Unmodified-Since`` headers.
889 b18ef3ad 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.
890 b18ef3ad Antony Chazapis
* Option to include only shared containers/objects in listings.
891 3ab38c43 Antony Chazapis
* Object metadata allowed, in addition to ``X-Object-Meta-*``: ``Content-Encoding``, ``Content-Disposition``, ``X-Object-Manifest``. These are all replaced with every update operation, except if using the ``update`` parameter (in which case individual keys can also be deleted). Deleting meta by providing empty values also works when copying/moving an object.
892 1d5c57d3 Antony Chazapis
* Multi-range object ``GET`` support as outlined in RFC2616.
893 1d5c57d3 Antony Chazapis
* Object hashmap retrieval through ``GET`` and the ``format`` parameter.
894 1d5c57d3 Antony Chazapis
* Object create via hashmap through ``PUT`` and the ``format`` parameter.
895 1d5c57d3 Antony Chazapis
* Object create using ``POST`` to support standard HTML forms.
896 1d5c57d3 Antony Chazapis
* Partial object updates through ``POST``, using the ``Content-Length``, ``Content-Type``, ``Content-Range`` and ``Transfer-Encoding`` headers. Use another object's data to update with ``X-Source-Object`` and ``X-Source-Version``. Truncate with ``X-Object-Bytes``.
897 f2d7b5ab Antony Chazapis
* Object ``MOVE`` support.
898 c9af0703 Antony Chazapis
* Time-variant account/container listings via the ``until`` parameter.
899 1d5c57d3 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``.
900 f6c97079 Antony Chazapis
* Sharing/publishing with ``X-Object-Sharing``, ``X-Object-Public`` at the object level. Cross-user operations are allowed - controlled by sharing directives. Permissions may include groups defined with ``X-Account-Group-*`` at the account level. These apply to the object - not its versions.
901 3ab38c43 Antony Chazapis
* Support for prefix-based inheritance when enforcing permissions. Parent object carrying the authorization directives is reported in ``X-Object-Shared-By``.
902 8cb45c13 Antony Chazapis
* Large object support with ``X-Object-Manifest``.
903 104626e3 Antony Chazapis
* Trace the user that created/modified an object with ``X-Object-Modified-By``.
904 81f947fd Antony Chazapis
* Purge container/object history with the ``until`` parameter in ``DELETE``.
905 f2d7b5ab Antony Chazapis
906 f2d7b5ab Antony Chazapis
Clarifications/suggestions:
907 f2d7b5ab Antony Chazapis
908 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.
909 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.
910 f2d7b5ab Antony Chazapis
* A ``GET`` reply for a level will include all headers of the corresponding ``HEAD`` request.
911 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.
912 2938333b 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 (**TBD**).
913 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.
914 f2d7b5ab Antony Chazapis
* In headers, dates are formatted according to RFC 1123. In extended information listings, dates are formatted according to ISO 8601.
915 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.
916 a6eb13e9 Antony Chazapis
* A copy/move using ``PUT``/``COPY``/``MOVE`` will always update metadata, keeping all old values except the ones redefined in the request headers.
917 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.
918 f2d7b5ab Antony Chazapis
919 f2d7b5ab Antony Chazapis
The Pithos Client
920 f2d7b5ab Antony Chazapis
-----------------
921 f2d7b5ab Antony Chazapis
922 f2d7b5ab Antony Chazapis
User Experience
923 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^
924 f2d7b5ab Antony Chazapis
925 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.
926 f2d7b5ab Antony Chazapis
927 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:
928 f2d7b5ab Antony Chazapis
929 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.
930 f2d7b5ab Antony Chazapis
* The ``trash`` element, which contains files that have been marked for deletion, but can still be recovered.
931 f2d7b5ab Antony Chazapis
* The ``shared`` element, which contains all objects shared by the user to other users of the system.
932 f2d7b5ab Antony Chazapis
* The ``others`` element, which contains all objects that other users share with the user.
933 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.).
934 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.
935 f2d7b5ab Antony Chazapis
936 f2d7b5ab Antony Chazapis
Objects in Pithos can be:
937 f2d7b5ab Antony Chazapis
938 f2d7b5ab Antony Chazapis
* Assigned custom tags.
939 f2d7b5ab Antony Chazapis
* Moved to trash and then deleted.
940 f2d7b5ab Antony Chazapis
* Shared with specific permissions.
941 f2d7b5ab Antony Chazapis
* Made public (shared with non-Pithos users).
942 c9af0703 Antony Chazapis
* Restored from previous versions.
943 f2d7b5ab Antony Chazapis
944 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. 
945 f2d7b5ab Antony Chazapis
946 f2d7b5ab Antony Chazapis
Conventions and Metadata Specification
947 f2d7b5ab Antony Chazapis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
948 f2d7b5ab Antony Chazapis
949 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.
950 f2d7b5ab Antony Chazapis
951 ab2e317e 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 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.
952 f2d7b5ab Antony Chazapis
953 f2d7b5ab Antony Chazapis
The metadata specification is summarized in the following table.
954 f2d7b5ab Antony Chazapis
955 f2d7b5ab Antony Chazapis
===========================  ==============================
956 f2d7b5ab Antony Chazapis
Metadata Name                Value
957 f2d7b5ab Antony Chazapis
===========================  ==============================
958 f2d7b5ab Antony Chazapis
X-Object-Meta-*              Use for other tags that apply to the object
959 f2d7b5ab Antony Chazapis
===========================  ==============================
960 288c1d55 Antony Chazapis
961 288c1d55 Antony Chazapis
Recommended Practices and Examples
962 288c1d55 Antony Chazapis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
963 288c1d55 Antony Chazapis
964 288c1d55 Antony Chazapis
Assuming an authentication token is obtained (**TBD**), the following high-level operations are available - shown with ``curl``:
965 288c1d55 Antony Chazapis
966 288c1d55 Antony Chazapis
* Get account information ::
967 288c1d55 Antony Chazapis
968 288c1d55 Antony Chazapis
    curl -X HEAD -D - \
969 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
970 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user
971 288c1d55 Antony Chazapis
972 288c1d55 Antony Chazapis
* List available containers ::
973 288c1d55 Antony Chazapis
974 288c1d55 Antony Chazapis
    curl -X GET -D - \
975 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
976 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user
977 288c1d55 Antony Chazapis
978 288c1d55 Antony Chazapis
* Get container information ::
979 288c1d55 Antony Chazapis
980 288c1d55 Antony Chazapis
    curl -X HEAD -D - \
981 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
982 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos
983 288c1d55 Antony Chazapis
984 288c1d55 Antony Chazapis
* Add a new container ::
985 288c1d55 Antony Chazapis
986 288c1d55 Antony Chazapis
    curl -X PUT -D - \
987 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
988 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/test
989 288c1d55 Antony Chazapis
990 288c1d55 Antony Chazapis
* Delete a container ::
991 288c1d55 Antony Chazapis
992 288c1d55 Antony Chazapis
    curl -X DELETE -D - \
993 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
994 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/test
995 288c1d55 Antony Chazapis
996 288c1d55 Antony Chazapis
* List objects in a container ::
997 288c1d55 Antony Chazapis
998 288c1d55 Antony Chazapis
    curl -X GET -D - \
999 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1000 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos
1001 288c1d55 Antony Chazapis
1002 288c1d55 Antony Chazapis
* List objects in a container (extended reply) ::
1003 288c1d55 Antony Chazapis
1004 288c1d55 Antony Chazapis
    curl -X GET -D - \
1005 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1006 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos?format=json
1007 288c1d55 Antony Chazapis
1008 a6eb13e9 Antony Chazapis
  It is recommended that extended replies are cached and subsequent requests utilize the ``If-Modified-Since`` header.
1009 a6eb13e9 Antony Chazapis
1010 288c1d55 Antony Chazapis
* List metadata keys used by objects in a container
1011 288c1d55 Antony Chazapis
1012 288c1d55 Antony Chazapis
  Will be in the ``X-Container-Object-Meta`` reply header, included in container information or object list (``HEAD`` or ``GET``).
1013 288c1d55 Antony Chazapis
1014 288c1d55 Antony Chazapis
* List objects in a container having a specific meta defined ::
1015 288c1d55 Antony Chazapis
1016 288c1d55 Antony Chazapis
    curl -X GET -D - \
1017 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1018 ab2e317e Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos?meta=favorites
1019 288c1d55 Antony Chazapis
1020 288c1d55 Antony Chazapis
* Retrieve an object ::
1021 288c1d55 Antony Chazapis
1022 288c1d55 Antony Chazapis
    curl -X GET -D - \
1023 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1024 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/README.txt
1025 288c1d55 Antony Chazapis
1026 288c1d55 Antony Chazapis
* Retrieve an object (specific ranges of data) ::
1027 288c1d55 Antony Chazapis
1028 288c1d55 Antony Chazapis
    curl -X GET -D - \
1029 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1030 288c1d55 Antony Chazapis
         -H "Range: bytes=0-9" \
1031 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/README.txt
1032 288c1d55 Antony Chazapis
1033 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``.
1034 288c1d55 Antony Chazapis
1035 288c1d55 Antony Chazapis
* Add a new object (folder type) (**TBD**) ::
1036 288c1d55 Antony Chazapis
1037 288c1d55 Antony Chazapis
    curl -X PUT -D - \
1038 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1039 288c1d55 Antony Chazapis
         -H "Content-Type: application/folder" \
1040 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/folder
1041 288c1d55 Antony Chazapis
1042 288c1d55 Antony Chazapis
* Add a new object ::
1043 288c1d55 Antony Chazapis
1044 288c1d55 Antony Chazapis
    curl -X PUT -D - \
1045 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1046 288c1d55 Antony Chazapis
         -H "Content-Type: text/plain" \
1047 288c1d55 Antony Chazapis
         -T EXAMPLE.txt
1048 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/pithos/folder/EXAMPLE.txt
1049 288c1d55 Antony Chazapis
1050 288c1d55 Antony Chazapis
* Update an object ::
1051 288c1d55 Antony Chazapis
1052 288c1d55 Antony Chazapis
    curl -X POST -D - \
1053 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1054 288c1d55 Antony Chazapis
         -H "Content-Length: 10" \
1055 288c1d55 Antony Chazapis
         -H "Content-Type: application/octet-stream" \
1056 288c1d55 Antony Chazapis
         -H "Content-Range: bytes 10-19/*" \
1057 288c1d55 Antony Chazapis
         -d "0123456789" \
1058 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
1059 288c1d55 Antony Chazapis
1060 288c1d55 Antony Chazapis
  This will update bytes 10-19 with the data specified.
1061 288c1d55 Antony Chazapis
1062 288c1d55 Antony Chazapis
* Update an object (append) ::
1063 288c1d55 Antony Chazapis
1064 288c1d55 Antony Chazapis
    curl -X POST -D - \
1065 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1066 288c1d55 Antony Chazapis
         -H "Content-Length: 10" \
1067 288c1d55 Antony Chazapis
         -H "Content-Type: application/octet-stream" \
1068 288c1d55 Antony Chazapis
         -H "Content-Range: bytes */*" \
1069 288c1d55 Antony Chazapis
         -d "0123456789" \
1070 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
1071 288c1d55 Antony Chazapis
1072 1495b972 Antony Chazapis
* Update an object (truncate) ::
1073 1495b972 Antony Chazapis
1074 1495b972 Antony Chazapis
    curl -X POST -D - \
1075 1495b972 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1076 1495b972 Antony Chazapis
         -H "X-Source-Object: /folder/EXAMPLE.txt" \
1077 1495b972 Antony Chazapis
         -H "Content-Range: bytes 0-0/*" \
1078 1495b972 Antony Chazapis
         -H "X-Object-Bytes: 0" \
1079 1495b972 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
1080 1495b972 Antony Chazapis
1081 1495b972 Antony Chazapis
  This will truncate the object to 0 bytes.
1082 1495b972 Antony Chazapis
1083 288c1d55 Antony Chazapis
* Add object metadata ::
1084 288c1d55 Antony Chazapis
1085 288c1d55 Antony Chazapis
    curl -X POST -D - \
1086 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1087 288c1d55 Antony Chazapis
         -H "X-Object-Meta-First: first_meta_value" \
1088 288c1d55 Antony Chazapis
         -H "X-Object-Meta-Second: second_meta_value" \
1089 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
1090 288c1d55 Antony Chazapis
1091 288c1d55 Antony Chazapis
* Delete object metadata ::
1092 288c1d55 Antony Chazapis
1093 288c1d55 Antony Chazapis
    curl -X POST -D - \
1094 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1095 288c1d55 Antony Chazapis
         -H "X-Object-Meta-First: first_meta_value" \
1096 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt
1097 288c1d55 Antony Chazapis
1098 288c1d55 Antony Chazapis
  Metadata can only be "set". To delete ``X-Object-Meta-Second``, reset all metadata.
1099 288c1d55 Antony Chazapis
1100 288c1d55 Antony Chazapis
* Delete an object ::
1101 288c1d55 Antony Chazapis
1102 288c1d55 Antony Chazapis
    curl -X DELETE -D - \
1103 288c1d55 Antony Chazapis
         -H "X-Auth-Token: 0000" \
1104 288c1d55 Antony Chazapis
         https://pithos.dev.grnet.gr/v1/user/folder/EXAMPLE.txt