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.eyJzdWIiOiIzMDUiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE3NjM2MjYzNjcsImV4cCI6MTc2NjIxODM2NywianRpIjoiZjFhMzU5NDAtZjBmZS00YTFmLTliODItYjVlZmU0ZmIyMzA4In0.qjSX4rG30qzuylC1j4IE7rhaeMcYf_M2-Rsy8zRqDrk
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/"51b2592fce3f144c9cdd92736d0d9449"
cache-control: max-age=0, private, must-revalidate
x-request-id: 2b2bad2e-614e-4c95-b75c-e6568e97d0f6
x-runtime: 0.011066
content-length: 596

Body

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