Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Cloud Rest API Java based integration

Muhammad Wasay Khan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 12, 2023

I want to write a java based program which will interaction with the Rest API exposed by Jira Cloud (https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/).

This program will interact with Jira to perform tasks like "Create Issue", "Update issue" etc.

I could not find and Java based rest client library that I can you for this purpose.

Does Atlassian publish and maintains such a library?

What I found on the internet is the following client library but can you confirm if this can be used to integrate with "JIRA Cloud"?

    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-core</artifactId> 

 

2 answers

1 accepted

0 votes
Answer accepted
Ben Kelley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 12, 2023

Hi there. Good question!

No Atlassian does not publish a pre-built library to call Jira Cloud APIs. The Maven artifact you list is the Jira Server library. The Jira Server library is built to work with a specific version of Jira Server. You will find that many things are different in Jira Cloud.

There is a solution though! We publish an Open API (aka "Swagger") spec that describes our API, and this works quite well with code generation tools. That way you can generate a client library in your language of choice (e.g. Java) from the spec.

This blog post walks you through a simple example: https://blog.developer.atlassian.com/update-to-jira-clouds-swagger-openapi-docs/

You may choose to generate a stand-alone library (like in the blog post), or you may choose to use the swagger codegen maven plugin to generate the library at build time.

Muhammad Wasay Khan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 16, 2023

Can you also explain the usage of the following java library.

Can this library be used in the java code to interaction with Jira Cloud APIs? I understand that I have to write a REST client anyways but I want to understand the purpose of this library.

 

<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>9.5.0</version>
<scope>provided</scope>
Ben Kelley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2023

This is a Java API for Jira Server for writing Java plugins, where you install the plugin in your Jira Server/Data Centre instance. This is very different to the REST API.

Like JinYuting Ryan likes this
0 votes
jon martin solaas February 2, 2023

Do not use swagger-codegen, use openapi-codegen (java version). Otherwise you will have to make endless tweaks to the generated code. Compile with java 8.

Yevhen Tienkaiev
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 30, 2024

Thanks, just for reference quick guide on how-to generate client using docker:

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
-i https://developer.atlassian.com/cloud/jira/platform/swagger-v3.v3.json \
-g java \
-o /local/client-from-openapi/java

Based on guide from openapi-generator

Like Jon Martin Solaas likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events