Я хочу загрузить файл в JIRA с помощью REST API.
Мой код:
$ch_api = curl_init('https://website.com/rest/api/2/issue/SI-10255/attachments');
curl_setopt($ch_api, CURLOPT_POST, true);
curl_setopt($ch_api, CURLOPT_POSTFIELDS, json_encode(["file" => "@t.txt"]));
curl_setopt($ch_api, CURLOPT_HTTPHEADER, array('Content-Type:multipart/form-data','X-Atlassian-Token:no-check'));
curl_setopt($ch, CURLOPT_USERPWD, "login:password");
curl_setopt($ch_api, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch_api);
curl_close($ch_api);
И у меня есть эта ошибка:
the request was rejected because no multipart boundary was found
И когда я добавляю границу, файл не загружается. Ответ от api был пустым массивом.
Пожалуйста, помогите.
Спасибо.