<?php
$username = 'xxxxxx';
$password = 'xxxxxxxx';
$url = "https://company.atlassian.net/rest/api/2/issue/";
$data_jira = array(
'fields' => array(
'project' => array(
'key' => 'MKT',
),
'summary' => "Test Data",
'customfield_10805' => "123456",
'customfield_10804' => "12345",
'description' => "Test Desc",
"reporter"=> array(
"name"=>"xxxxx"
),
"assignee"=> array(
"name"=>"xxxxxx"
),
"issuetype" => array(
"name" => "Story"),
)
);
$ch2= curl_init();
$headers = array(
'Accept: application/json',
'Content-Type: application/json'
);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_VERBOSE, 1);
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch2, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($data_jira));
curl_setopt($ch2, CURLOPT_URL, $url);
curl_setopt($ch2, CURLOPT_USERPWD, "$username:$password");
$result = curl_exec($ch2);
echo $result;
?>
Issue resolved.
Here is the reference for someone who got stuck in same situation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.