DirectUploads

POST direct_uploads

Endpoint

POST /api/v1/direct_uploads

Parameters

Name Description
file[filename] required File filename
file[byte_size] required File byte size
file[checksum] required File checksum
file[content_type] required File content type
file[metadata] File metadata

Request

Route

POST /api/v1/direct_uploads

Headers

Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyODgiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3Mzc1NTE1NTcsImV4cCI6MTc0MDE0MzU1NywianRpIjoiZjU3MGZhNDYtMzBiMi00MjFlLTk4YjctNDFjOWE2YWU5MTBmIn0.12SUM3B6mHfEM0rS0RK4HEnnYHjOi06MIzl-8nE5XfQ
Host: example.org
Cookie: 

Body

{
  "file": {
    "filename": "test_upload",
    "byte_size": 67969,
    "checksum": "VtVrTvbyW7L2DOsRBsh0UQ==",
    "content_type": "application/pdf",
    "metadata": {
      "message": "active_storage_test"
    }
  }
}

Response

Simulated Response

Status

200

Headers

x-frame-options: SAMEORIGIN
x-xss-protection: 0
x-content-type-options: nosniff
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
content-type: application/json; charset=utf-8
vary: Accept, Origin
etag: W/"8012405d2d8671df299bbc3ceba4d8bb"
cache-control: max-age=0, private, must-revalidate
x-request-id: b348e732-f452-4ca8-ab02-d67d26a746b5
x-runtime: 0.019263
content-length: 596

Body

{
  "direct_upload": {
    "headers": {
      "Content-Type": "application/pdf"
    },
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTYsInB1ciI6ImJsb2JfaWQifX0=--f3d466ac008c6277ebdb6dcdd940ff459dc75593",
    "url": "http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ1cGxvYWRzLzUyMTFlZjExLWRlOTMtNDliYi05NTc4LTNiYjYzNjNmYmE0NSIsImNvbnRlbnRfdHlwZSI6ImFwcGxpY2F0aW9uL3BkZiIsImNvbnRlbnRfbGVuZ3RoIjo2Nzk2OSwiY2hlY2tzdW0iOiJWdFZyVHZieVc3TDJET3NSQnNoMFVRPT0iLCJzZXJ2aWNlX25hbWUiOiJ0ZXN0In0sImV4cCI6IjIwMjUtMDEtMjJUMTQ6MTI6MzcuMzUxWiIsInB1ciI6ImJsb2JfdG9rZW4ifX0=--e2d5264bf16a341b822bbebae58fc91d7475886c"
  }
}