File uploads

File uploads are used for creating Documents and Signatures objects to attach them to Task objects.

💡

Files are directly uploaded to Amazon S3 where they are stored for usage later. Technical documentation for uploads can be found found here

Create a file upload request

HTTP Request

POST https://api.gsmtasks.com/file_uploads/

Request

{
"file_name": "important document.pdf",
"file_type": "application/pdf",
"source": "integration"
}

Response

You will get the following response with Amazon S3 signature to start the actual file upload process.

{
"id": "f4db8a4a-01a9-4065-acb1-830db7854b91",
"url": "https://api.gsmtasks.com/file_uploads/f4db8a4a-01a9-4065-acb1-830db7854b92/",
"file": "https://gsmtasks.s3.amazonaws.com/fileupload/f4db8a4a-01a9-4065-acb1-830db7854b92/important%20document.pdf",
"s3_signature": {
"url": "https://gsmtasks.s3.amazonaws.com/",
"fields": {
"acl": "public-read",
"Content-Type": "application/pdf",
"key": "fileupload/f4db8a4a-01a9-4065-acb1-830db7854b92/important document.pdf",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "AKIA3TP7DLREZYXKZYAO/20220303/eu-central-1/s3/aws4_request",
"x-amz-date": "20220303T134409Z",
"policy": "yyJleHBpcmF0aW9uIjogIjywMjItMDMtMDNUMTQ6NDQ6MDlaIiwgImNvbmRpdGlvbnMiOiBbeyJhY2wiOiAicHVibGljLXJlYWQifSwgeyJDb250ZW50LVR5cGUiOiAicGRmIn0sIHsiYnVja2V0IjogImdzbXRhc2tzIn0sIHsia2V5IjogImZpbGV1cGxvYWQvZjRkYjhhNGEtMDFhOS00MDY1LWFjYjEtODMwZGI3ODU0YjkxL2ltcG9ydGFudCBkb2N1bWVudC5wZGYifSwgeyJ4LWFtei1hbGdvcml0aG0iOiAiQVdTNC1ITUFDLVNIQTI1NiJ9LCB7IngtYW16LWNyZWRlbnRpYWwiOiAiQUtJQTNUUDdETFJFWllYS1pZQU8vMjAyMjAzMDMvZXUtY2VudHJhbC0xL3MzL2F3czRfcmVxdWVzdCJ9LCB7IngtYW16LWRhdGUiOiAiMjAyMjAzMDNUMTM0NDA5WiJ9XX0=",
"x-amz-signature": "85307503f19166eb2234a68cd18b3a0fbaf4d288d9a708aad0d09a7e96e16192"
}
},
"created_by": "https://api.gsmtasks.com/users/18fb9d97-824b-4c2a-9b74-764a88a78c92/",
"source": "integration",
"created_at": "2022-03-03T17:44:09.164169+04:00",
"updated_at": "2022-03-03T17:44:09.164191+04:00"
}

With this data the Amazon S3 file upload documentation can be followed.

Upload to Amazon S3

HTTP multipart/form-data Request

POST https://gsmtasks.s3.amazonaws.com/

Multipart form Parameters

  • acl
  • Content-Type
  • key
  • x-amz-algorithm
  • x-amz-credential
  • x-amz-date
  • policy
  • x-amz-signature
  • file (actual file content)

💡
A successful upload will return a 204 No Content response.

File upload

Attaching file uploads

After the upload process has be dont the file upload object can be attached to Documents and Signatures which are from there on attached to Tasks.

As an example we are creating a Document next from our file upload.

HTTP Request

POST https://api.gsmtasks.com/documents/

Request

{
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
"task": "https://api.gsmtasks.com/tasks/19373b06-911e-4663-96da-2a0d5215c0b3/",
"file_upload": "https://api.gsmtasks.com/file_uploads/f4db8a4a-01a9-4065-acb1-830db7854b92/",
"description": "Description of the uploaded file",
"visible_to_worker": true,
"visible_to_client": true
}

Response

You will get the following response with Amazon S3 signature to start the actual file upload process.

{
"id": "f49c879f-a1e1-4c5f-9572-51709bb77422",
"url": "https://api.gsmtasks.com/documents/f49c879f-a1e1-4c5f-9572-51709bb774f8/",
"account": "https://api.gsmtasks.com/accounts/a6f60fdf-d87b-4c5d-b5ec-67a90cd16236/",
"external_id": null,
"order": null,
"task": "https://api.gsmtasks.com/tasks/19373b06-911e-4663-96da-2a0d5215c0b3/",
"file": "https://gsmtasks.s3.amazonaws.com/document/f49c879f-a1e1-4c5f-9572-51709bb774f8/important_document.pdf",
"file_name": "important_document.pdf",
"description": "Description of the uploaded file",
"created_by": "https://api.gsmtasks.com/users/18fb9d97-824b-4c22-9b74-764a88a78c92/",
"source": null,
"visible_to_worker": true,
"visible_to_client": true,
"created_at": "2022-03-03T14:39:23.310925Z",
"updated_at": "2022-03-03T14:39:23.310955Z"
}