Media Storage API

API Endpoints

GET /is_logged_in

Returns 2 keys, "logged_in" which is true if user is logged in, false otherwise. And "uhash" which is to be used as a GET variable in a following call to /login.

Example data: { "logged_in": false, "uhash": "aef223bbf10116a4e11b64529ad430ae" }

GET /login?uhash={uhash} (webpage, not an API endpoint)

Forwards to login page, uhash is retrieve from the previous /is_logged_in call. If login process is successful, subsequent GETs to /is_logged_in will return with "logged_in" set to true.

GET /logout (webpage, not an API endpoint)

Logs user out. Subsequent GETs to /is_logged_in will return false.

POST /{project}/upload

Upload media files. The file's binary data is the body of the request. Returns a key for later retrieval.

Returns 404 if {project} doesn't exist. Returns 403 if user isn't logged in.

GET /{project}/list

List all available media keys for a project.

Returns 404 if {project} doesn't exist.

GET /{project}/media/{key}

Retrieves a media file by its key.

Returns 404 if {project} doesn't exist. Returns 404 if {key} doesn't exist.

DELETE /{project}/media/{key}

Delete a media file.

Returns 404 if {project} doesn't exist. Returns 404 if {key} doesn't exist. Returns a 403 if user isn't logged in, or isn't the one who uploaded this media file.

POST /{project}/media/{key}/metadata

Set metadata (JSON) for a media file.

Returns 404 if {project} doesn't exist. Returns 404 if {key} doesn't exist. Returns a 403 if user isn't logged in, or isn't the one who uploaded this media file.

GET /{project}/media/{key}/metadata

Retrieve metadata (JSON) for a media file.

Returns 404 if {project} doesn't exist. Returns 404 if {key} doesn't exist.