I'm trying to call the API of JIRA via PHP's cURL but I can't make the PUT/DELETE methods to work. cURL cli from linux work. Example:
curl -u user:pass -X PUT -H "Content-Type: application/json" --data '{"fields": {"summary": "[Test] Testing REST API!"}}' http://jirahost.com/rest/api/2/issue/testIssue
My PHP code:
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, $jirauser . ":" . $jirapass);
curl_setopt($curl, CURLOPT_URL, $jirahost . "issue/testIssue");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data)
print_r(curl_exec($curl));
My cURL
options are right, 'casue GET/POST
requests work.