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
1curl -X POST https://api.awork.com/api/v1/files/generateUploadURL \
2 -H 'Content-Type: application/json'

The response will look like this:

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

Then use the returned uploadUrl to upload the file:

Upload File
1curl -X PUT https://upload.awork.com/... \
2 -H 'Content-Type: image/png' \
3 --data-binary @/path/to/file.png

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

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

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
1curl -X POST https://api.awork.com/api/v1/files/images/projects/123e4567-e89b-12d3-a456-426614174000 \
2 -H 'Content-Type: multipart/form-data' \
3 -F 'File=@/path/to/file.png'

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

Built with