HTTP API¶
Cockatiel exposes a HTTP API that you can use to store, retrieve and delete files from its storage. The same API is being used by cockatiel for the communication between different nodes.
API methods¶
-
GET
/
(filename)¶ Returns the file with the given filename.
Request Headers: - If-None-Match – A value that you obtained from the
ETag
header of a response that you still have in your cache.
Response Headers: - Content-Type – The content type of a file, determined by its extension
- ETag – A hash value specific to this file. You can
specify this in the
If-None-Match
request header for cache validation. - Cache-Control – Cache control instructions, normally telling you that you can cache this for at least a year.
- X-Content-SHA1 – The SHA1 hash of the transmitted file
Status Codes: - 200 OK – if the file exists and can be read
- 304 Not Modified – if you provided
If-None-Match
- 404 Not Found – if the file does not exist
- 500 Internal Server Error – on any internal errors
- If-None-Match – A value that you obtained from the
-
PUT
/
(filename)¶ Creates a new file with the given filename. You are not guaranteed that the file is actually created with the given name, you should expect to get a new name in the
Location
response header.Request Headers: - X-Content-SHA1 – The SHA1 hash of the transmitted file (optional)
Response Headers: - Location – The relative or abosulte URL to the file with the name that acutally has been used when storing the file.
Status Codes: - 201 Created – if the file did not exist on this server before
- 302 Found – if the file already existed on this server previously
- 400 Bad Request – if you specified a SHA1 hash and it does not match the hash calculated on the server
- 408 Request Timeout – if data is coming in to slow
- 409 Conflict – if the file is known to be already deleted
- 500 Internal Server Error – on any internal errors
-
DELETE
/
(filename)¶ Deletes the file of the given name.
Status Codes: - 200 OK – if the file could be deleted successfully
- 404 Not Found – if the file did not exist
- 500 Internal Server Error – on any internal errors
-
HEAD
/
(filename)¶ Returns the meta data for the file with the given filename. This behaves exactly the same as
GET
, it just does not return the file’s content.Request Headers: - If-None-Match – A value that you obtained from the
ETag
header of a response that you still have in your cache.
Response Headers: - Content-Type – The content type of a file, determined by its extension
- ETag – A hash value specific to this file. You can
specify this in the
If-None-Match
request header for cache validation. - Cache-Control – Cache control instructions, normally telling you that you can cache this for at least a year.
- X-Content-SHA1 – The SHA1 hash of the file
Status Codes: - 200 OK – if the file exists and can be read
- 304 Not Modified – if you provided
If-None-Match
- 404 Not Found – if the file does not exist
- 500 Internal Server Error – on any internal errors
- If-None-Match – A value that you obtained from the
-
GET
/_status
¶ Returns status information on this node. This currently includes a dictionary that contains one dictonary for every neighbor node. This inner dictionary contains the current length of the replication queue, i.e. the number of operations known to this node that have not yet been sent to the respective other node.
Example response:
{ "queues": { "http://localhost:9001": { "length": 4 } } }
Status Codes: - 200 OK – in any known case