Hi
I'm now working on attaching attachment for issues based on REST API using PHP. This is my code:
<?php
$ch=curl_init();
$headers = array(
'X-Atlassian-Token: nocheck',
'Content-Type: multipart/form-data'
);
$data = array("file" => "attachments/test.txt");
curl_setopt_array(
$ch,
array(
CURLOPT_URL=>'http://localhost:8080/rest/api/latest/issue/IS-23/attachments',
CURLOPT_POST=>true,
//CURLOPT_HTTPGET =>true,
CURLOPT_VERBOSE=>1,
CURLOPT_POSTFIELDS=>$data,
CURLOPT_SSL_VERIFYHOST=> 0,
CURLOPT_SSL_VERIFYPEER=> 0,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_HEADER=>false,
CURLOPT_HTTPHEADER=> $headers,
CURLOPT_USERPWD=>"test:test"
)
);
$result=curl_exec($ch);
$ch_error = curl_error($ch);
if ($ch_error) {
echo "cURL Error: $ch_error";
} else {
var_dump($result);
}
curl_close($ch);
?>
=============
However, I could got any result. Any ideas?
Thanks