Skip to content

Commit 540d269

Browse files
authored
Merge pull request atlassian-api#197 from ysfiqbl/feature/update-project
Feature/update project
2 parents 8864048 + 9a32a0d commit 540d269

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

atlassian/jira.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,21 @@ def add_project_actor_in_role(self, project_key, role_id, actor, actor_type):
290290

291291
return self.post(url, data=data)
292292

293+
def update_project(self, project_key, data, expand=None):
294+
"""
295+
Updates a project.
296+
Update project: /rest/api/2/project/{projectIdOrKey}
297+
298+
:param project_key: project key of project that needs to be updated
299+
:param data: dictionary containing the data to be updated
300+
:param expand: the parameters to expand
301+
"""
302+
if expand:
303+
url = '/rest/api/2/project/{projectIdOrKey}?expand={expand}'.format(projectIdOrKey=project_key, expand=expand)
304+
else:
305+
url = '/rest/api/2/project/{projectIdOrKey}'.format(projectIdOrKey=project_key)
306+
return self.put(url, data)
307+
293308
def issue(self, key, fields='*all'):
294309
return self.get('rest/api/2/issue/{0}?fields={1}'.format(key, fields))
295310

docs/jira.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ Manage projects
118118
# Get all assignable users for project
119119
jira.get_all_assignable_users_for_project(project_key, start=0, limit=50)
120120
121+
# Update a project
122+
jira.update_project(project_key, data, expand='lead,description')
123+
121124
Manage issues
122125
-------------
123126

examples/jira-update-project.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# coding: utf8
2+
from atlassian import Jira
3+
4+
jira = Jira(
5+
url='https://jira.example.com/',
6+
username='admin',
7+
password='admin'
8+
)
9+
10+
data = {
11+
'permissionScheme': 10001
12+
}
13+
14+
result = jira.update_project('RD', data)
15+
print(result)

0 commit comments

Comments
 (0)