Skip to main content
Use this guide when your app needs to upload a file first and then create a Terminal49 document.
Any client stack can use this flow as long as it can make standard HTTP requests.

Overview

  1. Request a direct upload blob payload from Terminal49.
  2. Upload the file bytes to the returned direct_upload.url using the returned headers.
  3. Store the returned signed_id.
  4. Create a Terminal49 document with attached_document = signed_id.

1) Request a direct upload blob

Endpoint: POST /rails/active_storage/direct_uploads Send metadata for the file you want to upload:

Blob attributes explained

Example ways to generate values

Get file size in bytes:
Compute checksum (Base64(MD5(file_bytes))):
checksum must match the exact bytes you upload in step 2, or the upload will fail.
Example response:

2) Upload the file bytes to direct_upload.url

Use direct_upload.url to send the file, and send the direct_upload.headers object as request headers. Use whatever response is returned by that upload request.

3) Persist signed_id in your app

Save the signed_id with your internal record. You will use this value in the next step.
Do not send the S3 URL to POST /documents. Send signed_id in attached_document.

4) Create the document using attached_document

Endpoint: POST /documents