From bd6c8f0c120deb16cf7cf15f7db9751b46affd1e Mon Sep 17 00:00:00 2001 From: Michael Meisel Date: Tue, 5 Apr 2016 17:19:57 -0700 Subject: [PATCH] Adds move_to_backlog from the agile API https://docs.atlassian.com/greenhopper/REST/cloud/#agile/1.0/backlog-moveIssuesToBacklog --- jira/client.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/jira/client.py b/jira/client.py index 19cb22b9a..f2babe867 100644 --- a/jira/client.py +++ b/jira/client.py @@ -3108,6 +3108,28 @@ def rank(self, issue, next_issue): raise NotImplementedError('No API for ranking issues for agile_rest_path="%s"' % self._options['agile_rest_path']) + def move_to_backlog(self, issue_keys): + """ + Move issues in ``issue_keys`` to the backlog, removing them from all + sprints that have not been completed. + + :param issue_keys: the issues to move to the backlog + """ + + if self._options['agile_rest_path'] == GreenHopperResource.AGILE_BASE_REST_PATH: + url = self._get_url('backlog/issue', base=self.AGILE_BASE_URL) + payload = {'issues': issue_keys} + try: + self._session.post(url, data=json.dumps(payload)) + except JIRAError as e: + if e.status_code == 404: + warnings.warn('Status code 404 may mean, that too old JIRA Agile version is installed.' + ' At least version 6.7.10 is required.') + raise + else: + raise NotImplementedError('No API for moving issues to backlog for agile_rest_path="%s"' % + self._options['agile_rest_path']) + class GreenHopper(JIRA):