I try to create the issue in PHP (I cannot format this line as the nomal text):
$postvars = http_build_query(array('fields' => array('project' => array('key' => 'SUP'), 'summary' => $body, 'issuetype' => array("name" => "Bug"))));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://jira-address/rest/api/2/issue/createmeta');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 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_USERPWD, 'login:password');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
$r = curl_exec($ch);
var_dump($body, $r, curl_error($ch));
die();
The above code returns:
string(4) "test" bool(false) string(38) "The requested URL returned error: 405 "
Why JIra API returns HTTP error 405? How to resolve this problem? What is wrong with my code? How to create the issue in PHP? Can I check detailed information about the error? Could you help me?