I'm new to Jira REST API so I have a Jira running on localhost, just to get used to it. Right now I'm just tryring to authenticate. The problem ist, that I get a 403. This is my code:
$username = 'username';
$password = 'api token';
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$query = curl_exec($curl_handle);
$ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => JIRA_URL . '/rest/api/2/user?username=' . $USER, CURLOPT_USERPWD => $USERNAME . ':' . $PASSWORD,
CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_RETURNTRANSFER => true ));
$result = curl_exec($ch); curl_close($ch); echo json_decode($result);
Can you above code a trial? If this works, and are you admin on your instance, i.e. have permission to read users information.
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event