Files API

Create file

POST http://file-store.rosalinux.ru/api/v1/upload

Input:

file_store[file]:
Required file.

Request example:

$ curl --user myuser@gmail.com:mypass -POST -F "file_store[file]=@/path/to/file/archive.zip" http://file-store.rosalinux.ru/api/v1/upload

Response:

{
  "sha1_hash": "File SHA1"
}

Examples:

{
  "sha1_hash": "3a93e5553490e39b4cd50269d51ad8438b7e20b8"
}

Find a File

GET http://file-store.rosalinux.ru/api/v1/file_stores.json?hash=:hash

Parameters:

hash
Required String hash of the file.

Response:

[
  {
    "sha1_hash": "File SHA1",
    "file_name": "File name",
    "user": {
      "id": "User id in ABF",
      "uname": "User uname in ABF"
    }
  }
]

Example:

[
  {
    "sha1_hash": "3a93e5553490e39b4cd50269d51ad8438b7e20b8",
    "file_name": "kernel.tar.gz2",
    "user": {
      "id": "1",
      "uname": "ivan_aivazovsky"
    }
  }
]

Get a File

GET http://file-store.rosalinux.ru/api/v1/file_stores/:hash

Parameters:

hash
Required String SHA1 of the file.

Response:

File content

Destroy file

Users are only able to delete their own files.

DELETE http://file-store.rosalinux.ru/api/v1/file_stores/:hash.json

Parameters:

hash
Required String SHA1 of the file.

Request example:

$ curl --user myuser@gmail.com:mypass -X DELETE http://file-store.rosalinux.ru/api/v1/file_stores/3a93e5553490e39b4cd50269d51ad8438b7e20b8.json

Response

Status: 204 No Content