Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,131
Community Members
 
Community Events
168
Community Groups

How to get all sprints in project using JIRA REST API

Is there anything something like "http://www.example.com/jira/rest/agile/1.0/sprint?project=XYZ", to retrieve all the sprints in a project.

JIRA platform api can retrieve projects info and JIRA software API can retrieve sprints for a given board. But i need sprints for any given project (combination) or atleast boards for a given project so that i can retrieve sprints in those boards later

6 answers

1 accepted

8 votes
Answer accepted

Just in case you are still looking (or someone else is looking like me), you can get all the boards valid for a project with the same request to get all boards (see https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board-getAllBoards).

You just have to specify as query argument (projectKeyOrId) your project. Afterwards you can use https://docs.atlassian.com/jira-software/REST/cloud/#agile/1.0/board/{boardId}/sprint-getAllSprints to get all the sprints for a board.

This will include sprints not only for the project in question but all projects that are part of the board isn't it?

As far as I understand, the sprints belong to the board and not the project. The mentioned method will list the sprints of the current board.

And these sprints can be used in multiple projects.

I used something like this and receive all the sprints for a project.

but you cannot find the greenhoppers documentation now. it has been deprecated. but the UrL i mentioned below is still working.

 

https://codegen.atlassian.net/rest/greenhopper/latest/integration/teamcalendars/sprint/list?jql=project=XYZ

what is the date format in the response?

it is a hashcode and you cannot extract date from this. so u can get date for one sprint only. 

 

https://codegen.atlassian.net/rest/greenhopper/latest/integration/teamcalendars/sprint/list?jql=project=XYZ


I used something like this and receive all the sprints for a project.

but you cannot find the greenhoppers documentation now. it has been deprecated. but the url i mentioned above is still working.

How can we get Status in side sprint ?

You can get SprintManager bean and then get list of sprints.

private static SprintManager getGreenHopperRapidManager() {
OsgiContainerManager osgi = ComponentAccessor.getComponentOfType(OsgiContainerManager.class);
if (osgi == null) {
java.lang.System.out.println("OSGI Not Found");
return null;
}

Bundle[] bundles = osgi.getBundles();

for (int i = 0; i < bundles.length; i++) {
Bundle bundle = bundles[i];
if ("com.pyxis.greenhopper.jira".equals(bundle.getSymbolicName())) {
BundleContext bctx = bundle.getBundleContext();
try {
ServiceReference[] refs = bctx.getAllServiceReferences(null, null);
if (refs != null) {
for (int j = 0; j < refs.length; j++) {
Object prop = refs[j].getProperty("org.springframework.context.service.name");
if ("com.pyxis.greenhopper.jira".equals(prop)) {
ApplicationContext appCtx = (ApplicationContext) bctx.getService(refs[j]);
appCtx.getBeansOfType(SprintManager.class);
return (SprintManager) appCtx.getBean("sprintManagerImpl");
}
}
}
} catch (InvalidSyntaxException e) {
e.printStackTrace();
}
}
}
return null;
}

To get list of rapidviews in a project use : 

.../rest/greenhopper/latest/rapidviews/list?projectKey=PKY

Muito obrigado...

Like Stan the man likes this

Suggest an answer

Log in or Sign up to answer