Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,514
Community Members
 
Community Events
165
Community Groups

Issues with official JIRA Java REST client

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

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)

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you