How to add and remove issue to/from Sprint via REST API
This article will show you how to add or remove issue to an active sprint, which already has a valid Sprint ID.
- To add issue to sprint
Method: PUT
REST API: sprint/{sprintId}/issues/add
Example URL: http://jira:8080/rest/greenhopper/1.0/sprint/1/issues/add
Example JSON data: {"issueKeys":["DEMO-1"]}
- To remove issue from sprint
Method (for JIRA Agile 6.2 and later): PUT
Method (for earlier version of GreenHopper, example GH 6.0.1): DELETE
REST API: sprint/{sprintId}/issues/remove
Example URL: http://jira:8080/rest/JIRA Agile/1.0/sprint/1/issues/remove
Example JSON data: {"issueKeys":["DEMO-1"]}
The following is the complete example using cURL
:
curl -D- -u admin:admin -X PUT -d '{"issueKeys":["DEMO-1"]}' -H "Content-Type: application/json" http://jira:8080/rest/greenhopper/1.0/sprint/1/issues/add
To find more other JIRA Agile REST API, you can install Developer Toolbox and see the page on REST API. It will show the REST API that can be used in JIRA Agile as well by clicking on the dropdown besides the topic name.