Help Center

Files

Methods

POST /files/upload

This method uploads files for subsequent attachment to tasks. Files that are not referenced by any task are removed after a while.

POST https://api.pyrus.com/v4/files/upload

Request headers

Authorization: Bearer gAAA*****
Content-type: multipart/form-data; boundary=8d2f42366b41441
Content-Length: 5222

Request body

--8d2f42366b41441
Content-Disposition: form-data; name="file"; filename="filename.jpg"
Content-Type: application/octet-stream
//file body
--8d2f42366b41441--

Response body

{
  "guid": "08923d83-255b-4f18-b0eb-5c4d3b9bf1d2",
  "md5_hash": "cd4df826e3b9ce6e7895d8a31536d99d"
}

curl

curl -X POST \
  https://api.pyrus.com/v4/files/upload \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: multipart/form-data' \
  -H 'content-type: multipart/form-data; boundary=----8d2f42366b41441' \
  -F 'filename.jpg=@C:\Path\To\File\filename.jpg'

You will get the identifier of the downloaded file and its hash calculated by the MD5 algorithm. If you want to attach the uploaded file to the task, please use the add comment method. Just obtain an identifier and pass it into the attachments field.

Content-Type. The header of an upload request must be set to multipart/form-data; boundary=8d2f42366b41441. Boundary is a unique identifier that precedes and follows the body of a file.

Content-Length is the size of the content. It must be calculated for the entire body including the boundary identifier.

Upload only one file for each request. If you need to upload more than one file, you should call the upload endpoint several times. The maximum allowed size of the file is 2 GB.

GET /files/download/{file-id}

This method downloads file from pyrus.

GET https://api.pyrus.com/v4/files/download/1334

Response headers

Content-Disposition: attachment; filename=test.txt
Content-Length: 12
Content-Type: application/octet-stream

Response body

file content

curl

curl -X GET \
  https://api.pyrus.com/v4/files/download/1334 \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json'

Was this article helpful?