Forums

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

test Jira API credentials

David KLIMAS July 13, 2023

Hello community,

I am using Rest api to download the list of issues using this command

/rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=50&startAt=0

 This works fine, however, when providing wrong credentials or Api token, JIRA returns the following :

"{""startAt"":0,""maxResults"":50,""total"":0,""issues"":[]}"

 It says that there are 0 issues, it does not give an error.

Is there another REST fonction which I can use to test my credentials and tell the user that the username or token is wrong ?

The above return is not reliable: does it return 0 issues because there are no issues or does it return 0 because the credentials are wrong ?

Thank you

1 answer

1 accepted

2 votes
Answer accepted
Kian Stack Mumo Systems
Community Champion
July 13, 2023
David KLIMAS July 13, 2023

Thanks Kian. I tried this one, which seems to work for me:

/rest/auth/1/session

 It returns the following if i introduce wrong credentials or an expired API token:

"{""errorMessages"":[""You are not authenticated. Authentication required to perform this operation.""],""errors"":{}}"

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events