Deserializing JIRA REST API domain objects in Java

637 views
Skip to first unread message

gabor...@midori-global.com

unread,
Aug 18, 2016, 12:26:28 PM8/18/16
to Atlassian Connect Dev
Hi,

I am writing a Connect add-on in Spring Boot and I can successfully access JIRA REST API, obtaining a JSON string representaton of resources (e.g. an issue or project).
Is there a library to deserialize these JSON strings to JIRA domain objects?

I tried JRJC so far (https://bitbucket.org/atlassian/jira-rest-java-client) this way with no luck:

restTemplate.getForEntity("/rest/api/2/issue/" + key, Issue.class);

I ended up writing my own Jackson mappings, but using an Atlassian supported method would be much better. Any ideas?

Thanks,
Gabor

Fernando Boucquez

unread,
Aug 18, 2016, 12:52:46 PM8/18/16
to atlassian-...@googlegroups.com
We are using JRJC for quite some time (way before ac spring boot) and I'm not sure if I would recommend it for the cloud. JRJC brings old apache client libraries and old jackson 1 library that will make you life hard when integrating with spring boot and the new libraries. There is no much JRJC support going on, not complete, not up to date and it's very hard to extend due to all private and static fields and methods (spring ideology is the opposite to that). Every bug fix or change to the REST API requires a copy and paste of the parser and clients if you don't want to fully branch the code. 

For JRJC you would not need RestTemplate, you need a custom com.atlassian.jira.rest.client.api.AuthenticationHandler for JWT, maybe see how RestTemplate generates JWT tokens.

It would be great if  ac spring boots brings wtih the POJO model for JIRA/Confluence/Etc with just Jackson 2 annotation so serialization is easy when sending and receiving json via RestTemplate. I've started working on that model but I couldn't find the time to finish it as JRJC is quite embebed in my code now. I would move away from JRJC for my next addon. 

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Seb Ruiz

unread,
Aug 18, 2016, 1:07:04 PM8/18/16
to atlassian-...@googlegroups.com
Hi Gabor,

We don't yet have full integration with the JRJC for Spring Boot. Follow ACSPRING-20 for details on when this is done, and for now have a look at https://bitbucket.org/epehrson/atlassian-connect-spring-boot-jira-rest-java-client-example for an example of how to use jira-rest-java-client for JSON parsing.

Cheers

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Seb Ruiz
Atlassian

Fernando Boucquez

unread,
Aug 18, 2016, 1:12:09 PM8/18/16
to atlassian-...@googlegroups.com
Thanks for the links Seb!

To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Seb Ruiz
Atlassian

Einar Pehrson

unread,
Aug 19, 2016, 3:20:39 AM8/19/16
to atlassian-...@googlegroups.com

Hey,

I've started integrating JRJC properly, but it's not quite ready to release. See JiraIssueRestClient for an example usage.

Cheers!
Einar

gabor...@midori-global.com

unread,
Aug 19, 2016, 3:39:50 AM8/19/16
to Atlassian Connect Dev
Hey Guys,

Thank you for your quick and useful answers, I really appreciate your help!

Cheers,
Gabor
Reply all
Reply to author
Forward
0 new messages