WORKSECTION

Files

Adding files to projects, tasks and comments through API

To add files, use POST requests with each file transferred as a separate parameter named attach (n), where n is any seed value (see code example below).

Files can be added in the following methods:

Sample of adding files in post_task request using PHP (curl) as an example:

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'https://your—domain.com/api/admin/v2/
?action=post_task&page=/project/PROJECT_ID/&email_user_from=USER_EMAIL&
email_user_to=USER_EMAIL&hidden=USER_EMAIL,USER_EMAIL&title=TASK_NAME&
text=TASK_TEXT&datestart=DD.MM.YYYY&dateend=DD.MM.YYYY&tags=Tag1,
Tag2&hash=HASH');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, [
  'attach[0]' = new cURLFile('path_to_file/local_file1.pdf',
'application/pdf','nice_name1.pdf'),
  'attach[1]' = new cURLFile('path_to_file/local_file2.pdf',
'application/pdf','nice_name2.pdf'),
]);
$response = json_decode(curl_exec($curl), true);
curl_close($curl);

Downloading files through API: download

Sample download request:

https://your-domain.com/api/admin/v2/?action=download& page=/download/FILE_ID/&hash=HASH
Allows downloading files attached to a task/subtask description or in comments
Method does not apply to files attached to project descriptions or uploaded directly into the Files section

Required parameters:

 
esc
или
Print