Skip to content

primelib/jira4j

Repository files navigation

Jira4J

A java client for the JIRA REST APIs.

Module: REST-V3

Maven Central javadoc

Installation

implementation("io.github.primelib:jira4j-rest-v3:<latestVersion>")

Click to view instructions for other build tools.

Usage

Consumer Specification Approach

JiraRESTV3ConsumerApi client = JiraRESTV3Factory.create(spec -> {
    spec.baseUrl("https://your-domain.atlassian.net");
    spec.api(JiraRESTV3ConsumerApi.class);
    spec.bearerAuth(authSpec -> {
        authSpec.token("<your-personal-access-token>");
    });
});

client.getIssue(spec -> {
    spec.issueIdOrKey("TEST-1");
});

Parameter Approach

JiraRESTV3Api client = JiraRESTV3Factory.create(spec -> {
    spec.baseUrl("https://your-domain.atlassian.net");
    spec.api(JiraRESTV3Api.class);
    spec.bearerAuth(authSpec -> {
        authSpec.token("<your-personal-access-token>");
    });
});

client.getIssue("TEST-1", null, null, null, null, null);

NOTE: The Parameter Approach can break if the API changes. The Consumer Specification Approach is more resilient to API changes.

Module: REST-V2

Maven Central javadoc

Installation

implementation("io.github.primelib:jira4j-rest-v2:<latestVersion>")

Click to view instructions for other build tools.

Usage

Consumer Specification Approach

JiraRESTV2ConsumerApi client = JiraRESTV2Factory.create(spec -> {
    spec.baseUrl("https://your-domain.atlassian.net");
    spec.api(JiraRESTV2ConsumerApi.class);
    spec.bearerAuth(authSpec -> {
        authSpec.token("<your-personal-access-token>");
    });
});

client.getIssue(spec -> {
    spec.issueIdOrKey("TEST-1");
});

Parameter Approach

JiraRESTV2Api client = JiraRESTV2Factory.create(spec -> {
    spec.baseUrl("https://your-domain.atlassian.net");
    spec.api(JiraRESTV2Api.class);
    spec.bearerAuth(authSpec -> {
        authSpec.token("<your-personal-access-token>");
    });
});

client.getIssue("TEST-1", null, null, null, null, null);

NOTE: The Parameter Approach can break if the API changes. The Consumer Specification Approach is more resilient to API changes.

Links

License

Released under the MIT License.