Files & Images

awork allows you to upload files and images to tasks, projects, comments and many other entities.

Upload a file to a task

Uploading a file takes three steps.

  1. Generate upload URL
  2. Upload the file
  3. Link it with an entity such as a task
Generate Upload URL
curl -X POST https://api.awork.com/api/v1/files/generateUploadURL \
-H "Authorization: Bearer {token}" \
-H 'Content-Type: application/json'

The response will look like this:

{
"uploadUrl": "https://upload.awork.com/...",
"uploadId": "123e4567-e89b-12d3-a456-426614174000"
}

Then use the returned uploadUrl to upload the file:

Upload File
curl -X PUT https://upload.awork.com/... \
-H 'Content-Type: image/png' \
-H 'x-ms-blob-type: BlockBlob' \
--data-binary @/path/to/file.png

Once that is done, link the uploaded file with a task:

Link File with Task
curl -X POST https://api.awork.com/api/v1/tasks/123e4567-e89b-12d3-a456-426614174000/files/byUploadId \
-H "Authorization: Bearer {token}" \
-H 'Content-Type: application/json' \
-d '{
"uploadId": "123e4567-e89b-12d3-a456-426614174000",
"fileName": "file.png"
}'

Upload a profile image

Several entities in awork support profile images. This is how you can upload an image for a project profile icon:

Request
curl -X POST https://api.awork.com/api/v1/files/images/projects/123e4567-e89b-12d3-a456-426614174000 \
-H "Authorization: Bearer {token}" \
-H 'Content-Type: multipart/form-data' \
-F 'File=@/path/to/file.png'

See more on working with files and images in the Help Center.