How to get Sprint information using Java API ?

Is there a way to retrieve the following information for a given Sprint using Jira or greenhopper Java API:

start date
end date
Number of Issues
Number of Sub-tasks per Issue
Number of "Done" Sub-tasks per Issue and their Resolved date

 

Please advise. Thanks in advance.

4 answers

Hello, you could use JIRA api Rest to retrieve Sprint information :

rest/greenhopper/1.0/sprintquery/[rapidviewID]"

Related discussion :

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-access-Sprint-details-using-Api/qaq-p/512783

Is this true even if I am creating a plugin?

I can't use the Java API?

0 votes

Use sprintManager.getSprint() to fetch it (or if you don't have the id, look at SprintQueryService).

Then I think it's probably SprintHelper to fetch details from it.

Which way is prefered? (when developing a plugin)

This plugin is going to generate a burndown chart.

 

Is there some sample code that I can look at? (I am  using Jira 7.5)

Most, if not all solutions posted online are outdated :\

If you can point to anything at this point that can help, I would greatly appreciate it!

I tried searching for a Java REST client and I found this:

jrjc

and

jira-client

 

The moment I touch my pom.xml file (by adding the dependency), I get this

atlassian-jira.log:2017-11-09 14:28:58,810 localhost-startStop-1 ERROR [c.a.p.osgi.factory.OsgiPluginInstalledHelper] Cannot determine required plugins, cannot resolve bundle 'com.atlassian.tutorial.myPlugin'

and this

atlassian-jira.log:2017-11-09 14:29:04,510 localhost-startStop-1 ERROR [c.a.p.osgi.factory.OsgiPlugin] Detected an error (BundleException) enabling the plugin 'com.atlassian.tutorial.myPlugin' : Unresolved constraint in bundle com.atlassian.tutorial.myPlugin [172]: Unable to resolve 172.0: missing requirement [172.0] osgi.wiring.package; (osgi.wiring.package=com.sun.xml.fastinfoset.sax). This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN

when i atlas-run.

Which results into my plugin getting disabled and my corrupted (i can never get it enabled again). Luckily I have a backup copy that I can refer to when this happens.

This is telling me that a piece of the puzzle is missing or incompatable (aka outdated).

 

help.

SprintManager if you have the sprint Id already, but SprintQueryService if you need to search.

Dumb question:

how do you use SprintManager.

sample code?

 

tried this:

 

SprintManager sm = ComponentAccessor.getComponent(SprintManagerImpl.class);

how use SprintManager ?you method can't work;

Hi @Sevak Asadorian,

This is late, but I'm working on a similar project for JIRA v7.3 and found that you can get some info about a sprint from the (java) API using the CustomField.getValue() method. This method returns the sprint name, id, start and end dates, and a few more in a list that you can then parse.

I posted about it a little here: 

https://community.atlassian.com/t5/Jira-discussions/Custom-Sprint-Report-getting-sprint-info-from-Java-API-JIRA/m-p/688870#M1691

Hope it helps!

you are right,i can use Sprint when i import greenhopper. SprintManager can't work yet;

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,968 views 2 7
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you