Hi,
My API work fine the last week but today i can’t call API JIRA (all API doesn’t work).
I reset my passord, and create a new API token but no success.
Does my email desactivate due to many tests ?
My API :
public HttpResponse < JsonNode > getAllUsers(String startAt, String maxResult) throws UnirestException {
String UrlRest3 = JiraUrl + "rest/api/3/users/search";
String UrlRestComplet = UrlRest3 + "?startAt=" + startAt + "&maxResults=" + maxResult;
HttpResponse < JsonNode > response = Unirest.get(UrlRestComplet)
.basicAuth(JiraUserMail, JiraToken)
.header("Accept", "application/json")
.asJson();
return response;
}
thanks,
Hi @KarimCHERIFI ,
thanks for reaching out.
I have checked it with our docs and I’m pretty sure that you are getting 400 errors because of missing query param.
Note that one of property
, accountId
or query
is mandatory.
Hope it helps,
Beata
@BeataSzturemska ,
You linked to user
(singular) but the post has users
(plural). I don’t see accountId
or query
for get all users using GET /rest/api/3/users/search
.
Ok, you are right.
I wasn’t aware that we have two so similar endpoints.
Is it possible that my email is desactivated due to many test ?
Don’t think so.
Can you do some debugging with code attached below?
GetRequest x = Unirest.get(UrlRestComplet)
.basicAuth(JiraUserMail, JiraToken)
.header("Accept", "application/json");
System.out.println(x.asString().getStatus());
System.out.println(x.asString().getStatusText());
System.out.println(x.asString().getBody());
System.out.println(x.asString().getHeaders());
If it doesn’t help, can you provide x-arequestid
returned by Jira in header?
Thanks for your response.
The result is :
401
Unauthorized
Basic authentication with passwords is deprecated. For more information, see: Deprecation notice - Basic authentication with passwords
{Transfer-Encoding=[chunked], Strict-Transport-Security=[max-age=315360000; includeSubDomains; preload], Server=[AtlassianProxy/1.19.3.1], ATL-TraceId=[a76ddeb60c684aaf], X-Content-Type-Options=[nosniff], Connection=[keep-alive], X-XSS-Protection=[1; mode=block], Date=[Mon, 14 Feb 2022 15:19:39 GMT], Content-Type=[text/plain], Expect-CT=[report-uri=“https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy ”, enforce, max-age=86400]}
I use a email and token : .basicAuth(jiraAPI.getJiraUserMail() , jiraAPI.getJiraToken())
@KarimCHERIFI ,
Could you also print out the full UrlRestComplet
? I just successfully completed a REST API request to my own instance using username & API token. So there is something specific in your case.
Do you think your organization might have enacted IP allow listing ? While this does not affect Connect, Forge, or OAuth 2 apps, it would prevent simple API token requests.
Here my url complete, i replace my org by {my_ord_url}.
https://{my_org_url}/rest/api/3/users/search
There is no change about “IP allow listing”, it’s empty.
Last Thursday all was OK, but now it’s impossible to call a API.
@KarimCHERIFI ,
I can’t help troubleshoot on this end if I don’t know your org URL. If you don’t feel comfortable sharing it in public, can you direct message it to me in this platform?
KarimCHERIFI:
a76ddeb60c684aaf
To me it looks like improper pair of email and token.
Can you double check if it’s proper?
Secondly, can you check if Last accessed
date changes on the page below?
https://id.atlassian.com/manage-profile/security/api-tokens
1 Like
Thanks a lot Atlassien Staf, now it’s OK.
My URL was not good.
I create a token with “Atlassian account ” and now it’s OK.
Thanks !!
2 Likes