Uploads

Get upload properties for a file

Get upload properties for a file a client wish to upload on TextMaster. Theses properties can then be used to make the HTTP request on the storage provider with the file sent as HTTP form data.

OAuth: This endpoint requires the default public scope.

Get Upload Properties

POSThttps://api.textmaster.com/v1/clients/upload_properties
Authorization
Body

File name for the uploaded file

file_name*string

File name for the uploaded file

hashed_payload*string

SHA256 digest of the file content

Response

File Uploaded

Body
url*string
headers*object
Request
const response = await fetch('https://api.textmaster.com/v1/clients/upload_properties', {
    method: 'POST',
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    body: JSON.stringify({
      "file_name": "text",
      "hashed_payload": "text"
    }),
});
const data = await response.json();
Response
{
  "url": "text",
  "headers": {
    "x-upload-path": "text",
    "x-upload-sha256": "text",
    "x-upload-date": "text",
    "Authorization": "text"
  }
}

Code samples

curl "https://api.textmaster.com/v1/clients/upload_properties" \
  -X POST \
  --data-urlencode "file_name=my-file.pdf" \
  --data-urlencode "hashed_payload=f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2" \
  -H "Authorization: Bearer 427ba17dc03db4792cd8d3c731ed53addd261b1baa7eef1ceda2cf2ca20f2b79"

# Response:
#
# {
#   "url": "https://storage-proxy.textmaster.com/api-files/uploads/10922fb8-9265-4ef2-92e8-c4177c3b03da/ef9f1ca8/my-file.pdf",
#   "headers": {
#     "x-upload-path": "uploads/10922fb8-9265-4ef2-92e8-c4177c3b03da/ef9e1ca8/my-file.pdf",
#     "x-upload-sha256": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e39b7605022da52e6ccc26fd2",
#     "x-upload-date": "20500102T123456Z",
#     "Authorization": "78ca271e7f6464961ef3db6903da3d2c51cd4156975322ba678840e12a334de3"
#   }
# }

curl "https://storage-proxy.textmaster.com/api-files/uploads/10922fb8-9265-4ef2-92e8-c4177c3b03da/ef9f1ca8/my-file.pdf" \
  -X PUT \
  -H "x-upload-path: uploads/10922fb8-9265-4ef2-92e8-c4177c3b03da/ef9e1ca8/my-file.pdf" \
  -H "x-upload-sha256: f2ca1bb6c7e907d06dafe4687e579fce76b37e4e39b7605022da52e6ccc26fd2" \
  -H "x-upload-date: 20500102T123456Z" \
  -H "Authorization: 78ca271e7f6464961ef3db6903da3d2c51cd4156975322ba678840e12a334de3" \
  -H "Content-Type: application/pdf" \
  -d "@path/to-the-actual-file/my-file.pdf"

Last updated