How to get start and end dates of a sprint using jira api?

a 夏天 提交于 2019-12-14 02:57:35

问题


Below url is giving all the information except start and end dates of a sprint .

http://jira.example.com/rest/api/2/search?fields=assignee,key,summary,worklog,timeoriginalestimate,aggregatetimespent,&jql=project=BLAH+AND+sprint=57


回答1:


To get dates from active sprint:

url = 'https://www.example.com/rest/agile/1.0/board/{rapidViewId}/sprint?state=active'

And closed:

url = 'https://www.example.com/rest/agile/1.0/board/{rapidViewId}/sprint?state=closed'

You could use the same also to get information about future sprint (just change "closed" to "future") but keep in mind that future sprints doesn't have dates, but you can get name and sprintID.




回答2:


Assuming you're a recent version of JIRA and JIRA Software, you can use the JIRA Agile REST API's.

Interesting REST API resources are:

Get Issue: GET /rest/agile/1.0/issue/{issueIdOrKey}
The output of this resource will also include the agile fields and the sprint name and its id, e.g.:

...
"sprint": {
    "id": 37,
    "self": "http://www.example.com/jira/rest/agile/1.0/sprint/13",
    "state": "future",
    "name": "sprint 2"
},
...

Get Sprint: GET /rest/agile/1.0/sprint/{sprintId} The output of this resource include the sprint start and end dates, e.g.:

{
    "id": 37,
    "self": "http://www.example.com/jira/rest/agile/1.0/sprint/23",
    "state": "closed",
    "name": "sprint 1",
    "startDate": "2015-04-11T15:22:00.000+10:00",
    "endDate": "2015-04-20T01:22:00.000+10:00",
    "completeDate": "2015-04-20T11:04:00.000+10:00",
    "originBoardId": 5
}

The docs may also contain other useful resources for you.



来源:https://stackoverflow.com/questions/37429723/how-to-get-start-and-end-dates-of-a-sprint-using-jira-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!