File

A file is a representation of the uploaded data.

Get all files

GET /files

Response

Status: 200 OK
{
  "files": [
    {
      "name": "file.pdf",
      "links": [
        {
          "rel": "self",
          "href": "https://portal.cryptorage.com/api/files/8374db79-4967-4055-b302-018298692a69"
        }
      ]
    },
    {
      "name": "file.txt",
      "links": [
        {
          "rel": "self",
          "href": "https://portal.cryptorage.com/api/files/6035ee47-d3e0-4631-b1f3-52324c5250fe"
        }
      ]
    }
  ]
}

General error

Status: 500 Server Error
error message

Get data for a file

GET /files/:uuid

Response

Status: 200 OK
{
  "file": {
    "uuid": "8374db79-4967-4055-b302-018298692a69",
    "name": "file.pdf",
    "description": "This is the file description.",
    "size": 10240,
    "content_type": "application/pdf",
    "download_notification": true,
    "created_at": "2011-12-03T04:33:35Z",
    "expires_at": "2011-12-13T04:33:35Z",
    "recipients": [
      {
        "name": "Jane Doe",
        "links": [
          {
            "rel": "self",
            "href": "https://portal.cryptorage.com/api/contacts/42"
          }
        ]
      },
      {
        "name": "James Does",
        "links": [
          {
            "rel": "self",
            "href": "https://portal.cryptorage.com/api/colleagues/23"
          }
        ]
      }
    ],
    "links": [
      {
        "rel": "self",
        "href": "https://portal.cryptorage.com/api/files/8374db79-4967-4055-b302-018298692a69"
      }
    ]
  }
}

Error

Status: 404 Not Found
{
  "error": "ERR_FILE_NOT_FOUND"
}

General error

Status: 500 Server Error
error message

Prepare an upload

POST /files
Payload:
{
  "name": "mysecretfile.txt",
  "download_notification": true,
  "description": "My secret file.",
  "expiration_period": 24,
  "key": "secret-key",
  "properties": {
    "reply_to": "reply@example.com"
  },
  "recipients": [
    {
      "name": "John Doe",
      "email": "john@example.com",
      "email2": "john2@example.com",
      "mobile": "01711234567",
      "channel": "mobile",
      "language": "de"
    },
    {
      "name": "Jane Doe",
      "email": "jane@example.com",
      "email2": "jane2@example.com",
      "mobile": "01711234568",
      "channel": "mail",
      "language": "en"
    }
  ]
}

Response

Status: 201 Created
{
  "file": {
    "name": "mysecretfile.txt",
    "description": "My secret file.",
    "download_notification": true,
    "expiration_period": 24,
    "properties": {
      "cfs_form": false,
      "reply_to": "reply@example.com"
    },
    "links": [
      {
        "rel": "self",
        "href": "https://portal.cryptorage.com/api/files/8374db79-4967-4055-b302-018298692a69"
      },
      {
        "rel": "store",
        "href": "https://portal.cryptorage.com/store/8374db79-4967-4055-b302-018298692a69"
      }
    ]
  }
}

Error

Status: 422 Unprocessable File
{
  "error": "ERR_FILE_NOT_VALID"
}

General error

Status: 500 Server Error
error message

Upload

POST /store/:uuid
Payload:
multipart/form-data
Content-Disposition: form-data; name="key" <key>
Content-Disposition: form-data; name="file"; filename=<filename>

Response

Status: 200 OK
{
  "ok": "true"
}

Error

Status: 500 Server Error
{
  "error": "ERR_UPLOAD_NOT_ALLOWED"
}

General error

Status: 500 Server Error
error message