Skip to content

Commit f068e4b

Browse files
authored
Merge pull request #362 from austinmh12/master
Added create_custom_field
2 parents 387afc4 + c5f558a commit f068e4b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

atlassian/jira.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,22 @@ def get_custom_fields(self, search=None, start=1, limit=50):
577577
if limit:
578578
params['maxResults'] = limit
579579
return self.get(url, params=params)
580+
581+
def create_custom_field(self, name, type, search_key=None, description=None):
582+
"""
583+
Creates a custom field with the given name and type
584+
:param name: str
585+
:param type: str, like 'com.atlassian.jira.plugin.system.customfieldtypes:textfield'
586+
:param search_key: str, like above
587+
:param description: str
588+
"""
589+
url = 'rest/api/2/field'
590+
data = {'name': name, 'type': type}
591+
if search_key:
592+
data['search_key'] = search_key
593+
if description:
594+
data['description'] = description
595+
return self.post(url, data=data)
580596

581597
def get_all_available_screen_fields(self, screen_id):
582598
"""

0 commit comments

Comments
 (0)