Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Rest API stoped working(Unauthorized (401))

Sandeep Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 10, 2019

<?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;
?>

1 answer

1 accepted

0 votes
Answer accepted
Sandeep Kumar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 11, 2019

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events