Search code examples
jirajira-rest-apijira-agilejira-rest-java-api

Access JIRA Agile sprints with JIRA REST Client api


Does anyone know about how to access JIRA Agile sprints with JIRA java REST Client api or in some other way with java.

1) I am trying to retrieve JIRA data (projects, sprints, issues etc). i need a way to query the projects, sprints with different filters as well. i guess JRJC cannot get agile data. Is there any one stop solution for entire JIRA data?

2) JIRA gave 2 types api in their docs: REST Api and Java Api. when to use each of those


Solution

    1. All of the info you want is available here:

    https://docs.atlassian.com/jira/REST/latest/

    Note that you can get project info with this: https://docs.atlassian.com/jira/REST/latest/#api/2/project

    a) As for sprint info - can you get the info you need with JQL? Example - can you go to Issues > Search for issues and use the basic search? Here, under the "More" option, you will see that you can specify the Sprint to filter for.

    As you add/remove sprints, you will see the URL changing. For example if I chose to see all issue types from Sprint 1 and Sprint 6 my JQL looks like this:

    ?jql=Sprint%20in%20(227%2C%20229)
    

    Note that these are the sprint ids.

    Now you can just call the rest api with search like this:

    https://jira.domain.com/rest/api/2/search?jql=Sprint%20in%20(227%2C%20229)
    

    More details here: https://docs.atlassian.com/jira/REST/latest/#api/2/search

    b) If you can get the info you want with a filter you can simply save the filter and call the filter with the rest api

    https://jira.domain.com/rest/api/2/filter/{filter-id}
    

    More details here: https://docs.atlassian.com/jira/REST/latest/#api/2/filter-getFilter

    1. The second part of your question is really another stackoverflow question: The jira REST API is simply a REST API - which are HTTP method calls to get data. You can call these with PHP, Java(with Jersey, for example), bash (using curl) or even just using a browser with - Chrome postman, for example.

    The Java API, or the REST Java Client for Jira is an unsupported set of libs that you can use if you specifically want to use Java to makes these rest calls. Of course you can use Jersey or whatever else you want to make the Rest calls, but the Java Client provides some libraries that might be helpful.