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.
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;
}
I have this error :
Exception in thread "main" com.mashape.unirest.http.exceptions.UnirestException: java.lang.RuntimeException: java.lang.RuntimeException: org.json.JSONException: A JSONArray text must start with '[' at 1 [character 2 line 1]
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:143)
at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
at com.ag2rlm.jira.api.JiraAPI.getAllUsers(JiraAPI.java:72)
at TestJiraAPI_GetAllUsers.main(TestJiraAPI_GetAllUsers.java:24)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.json.JSONException: A JSONArray text must start with '[' at 1 [character 2 line 1]
Thanks,
I ran into this same problem, and debugging into the library I learned that it was because the API was not returning JSON, in my case because authentication was denied with the reason 'CAPTCHA required'. It was difficult to determine this from the error output by this Unirest call. However if you first attempt to call the API with a String response:
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.