Hi,
I'm new in using jira rest api.
Here is my code:
$username = 'xxxx';
$password = 'xxxx';
$url = 'http://1.2.3.4:8080/rest/api/2/Issue/DEMO-7';
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$issue_list = (curl_exec($curl));
echo $issue_list;
Why am I getting this error?:
Encountered a 401 - Unauthorized
error while loading this page.
How to deal with this? Is there anything I need to configure in JIRA or in my Server?
If you have simpliest approach in calling rest api I will be glad to know it.
Community moderators have prevented the ability to post new answers.
It looks like you've entered wrong credencials. This code works fine, after changing "Issue" to "issue" in URL.
I've got 401 when username/password was incorrect.
The other thing may be that your user is locked and you need to solve captcha - try to login with that credentials to JIRA via web interface.
Hope that I could help,
Alek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, this same thing happens to us. When we connect via curl, the account is eventually being locked. Is there a way to avoid that? We can't always log in on the web interface just to solve the captcha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.