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.eyJzdWIiOiIyOTUiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3NTMyNjYxNzYsImV4cCI6MTc1NTg1ODE3NiwianRpIjoiMTA0MmFlNGItZTdiNS00MzliLTgyZTUtY2ZhM2EyZDgxZjBiIn0.HsYMo3VINDz_ILCth7-3P-FBxiNcnpDRsayiAbQ4M8Y
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/"66e5318a711713375fc5d5db9473dc93"
cache-control: max-age=0, private, must-revalidate
x-request-id: 00466a38-e3a9-4930-9d91-cfaec5112d37
x-runtime: 0.022374
content-length: 596

Body

{
  "direct_upload": {
    "headers": {
      "Content-Type": "application/pdf"
    },
    "signed_id": "eyJfcmFpbHMiOnsiZGF0YSI6MTYsInB1ciI6ImJsb2JfaWQifX0=--9ae5476b0fe2e5ab6a9d857bbaf991c84949e4b7",
    "url": "http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ1cGxvYWRzL2VhOTIzNTQ3LWNiMWQtNDg4Yi1hYjJiLWEyNWQyMWJiYTcwYSIsImNvbnRlbnRfdHlwZSI6ImFwcGxpY2F0aW9uL3BkZiIsImNvbnRlbnRfbGVuZ3RoIjo2Nzk2OSwiY2hlY2tzdW0iOiJWdFZyVHZieVc3TDJET3NSQnNoMFVRPT0iLCJzZXJ2aWNlX25hbWUiOiJ0ZXN0In0sImV4cCI6IjIwMjUtMDctMjNUMTE6MjI6NTYuMjY5WiIsInB1ciI6ImJsb2JfdG9rZW4ifX0=--6d4a7c0070ad2d9960a2599bf39bd75444cf9cfe"
  }
}