Issues with official JIRA Java REST client

Tamino Dauth May 3, 2022

Hi,

first off my motivation to use the offical JIRA Java REST client:

We have been using https://github.com/rcarz/jira-client for quite some time but it has not been updated for a very long time. Besides, it got some issues like inacurrate timestamps for comments in JIRA issues. We do not want to use the REST calls creating our own DTOs in Java. We want to move to the offical JIRA Java REST client from Atlassian which is updated more often, has more possibilities to put more things into one single request and offers you to use an asynchronus API.

 

However, I got multiple issues with the official JIRA Java REST client:

- Why is the documentation not updated? https://ecosystem.atlassian.net/wiki/spaces/JRJC/overview is really old and examples or even basic Java maven projects are missing. This is the only documentation I have found so far: https://www.baeldung.com/jira-rest-api It uses an old version of the Java REST client. It still works but it is not offical and really short.

- Why can I not specify which fields I want to retrieve when using: restClient.getIssueClient().getIssue(issueKey).claim();

Currently, I have to use the search client to specify only some fields I am interested in to keep the traffic low:

restClient.getSearchClient().searchJql("key = " + issueKey, 1, 0, fieldsSet).claim();

Is this the official way to do this?!

- I often get the error:

"org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of ..." especially when I retrieve the issue with the search client. Is this normal? I do not want to retry the calls too often to avoid this issue.

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 3, 2022

Welcome to the Atlassian Community!

There is no "official" REST client - the JRJC project was an unsupported (but encouraged) by Atlassian side project, similar to some of their other apps such as the Jira Toolkit that are in the "Atlassian labs".  (Jira Toolkit might be a bad example to compare with - despite still being in Labs since before the earliest 3.13 you can see in downloads - I think I first installed it in Jira 3.0.3, bits of it are installed by default in Cloud)

So, as a Lab project, not an "official" product, with no-one currently maintaining it, and no support, I think you can probably guess why the docs are old and the code older!

I have been telling people to move away from it for a few years now, as I've seen it not updated as Jira went from Server 7.x to 8.x and Cloud got the new v3 REST API.

I would strongly recommend writing your own code for calls into DC or Cloud now (not Server, it's going away in less than two years)

Tamino Dauth May 5, 2022

Hi,

thanks for the answer. I won't use it anymore but write my own code instead.

Is there by any chance some open API I could use to generate the DTOs?

An alternative would be to use something like this: https://www.jsonschema2pojo.org/

 

As I said, I don't want to use Open Source clients anymore since they are not updated and there is no clear favorite as https://github.com/rcarz/jira-client has almost 400 forks.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2022

Have a read through https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/ to see if it can help.

Suggest an answer

Log in or Sign up to answer