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:
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:
DELETE /(filename)

Deletes the file of the given name.

Status Codes:
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:
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