Forums

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

Getting error unauthorize acccess while using Java Rest API

Gaurav Jain June 20, 2019

Hi All,

 

I am new to JIRA. I am trying to access JIRA through post man i am doing get access to URL

http://gauravj7.atlassian.net/rest/api/2/KPIT

 

with basic authentication user id gauravj7 and password **** but i am getting unauthorize access. is there anything i am missing?

1 answer

1 accepted

0 votes
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

Hello,

You need to use an API token instead of your password:

https://confluence.atlassian.com/cloud/api-tokens-938839638.html

Gaurav Jain June 20, 2019

No it didn't worked. I am hitting the URL in postman with Type as Basic Auth. Using user id as gauravj7 and password as what I set as password. can you please elaborate the steps

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

I am not sure what to elaborate. I gave you a link how you can generate an api token. Then use this token instead of your password

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

You still use basic auth, but instead of the password, set the api token

Gaurav Jain June 20, 2019

Hi it worked. Right now I am not getting error. But My queries are not giving output

Do I need to give special permission

 

Thanks for your reply. I changed as per your suggestion. Still I am not getting desired output

 

When I am using below query I am getting output

 

https://gauravj7.atlassian.net/rest/api/2/search?jql=assignee in "Gaurav Jain"

 

{

    "errorMessages": [

        "Field 'assignee' does not exist or this field cannot be viewed by anonymous users."

    ],

    "warningMessages": []

}

 

When I want to see all issues under project then also I am not getting output. Please help on urgent basis

 

https://gauravj7.atlassian.net/rest/api/2/search?jql=project="KPIT"

 

{

    "errorMessages": [

        "The value 'KPIT' does not exist for the field 'project'."

    ],

    "warningMessages": []

}

 

Please help me on urgent basis

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 21, 2019

You are still not authenticated. Also the correct api for cloud is:

 /rest/api/3/search

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 21, 2019

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events