I want to set one operation automatically, to download one file from my JIRA Atlassian account and save it in my server every day at a certain time. Very important is that my workspace using the Jira cloud. I want to download a file from this link:
https://workspacename.atlassian.net/secure/admin/CloudExport.jspa
I created API TOKEN for my account and try access via PHP cURL.
$user = 'name@xxx.com';
$password = 'pass.';
$url = "https://workspacename.atlassian.net/rest/api/2/project";
$ch = curl_init();
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer token_example'
);
$test = "This is the content of the custom field.";
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$user:$password");
$result = curl_exec($ch);
$ch_error = curl_error($ch);
if ($ch_error) {
echo "cURL Error: $ch_error";
} else {
echo $result;
}
curl_close($ch);
But I've got this error: {"error": "Failed to parse Connect Session Auth Token"}
Can someone help me? Did I something wrong?