I am trying the very basics of creating a task in jira through python using the module jira==3.5.2: https://jira.readthedocs.io/
I have the following code in my constants.py file:
from jira import JIRA
JIRA_TOKEN = "TOKEN"
ji = JIRA('https://ourdomain.atlassian.net', basic_auth=('[email protected]', JIRA_TOKEN))
And the following code in main.py:
from constants import *
from pprint import pprint
def jira_create_issue(summary: str, description: str):
issue_dict = {
'project': {'key': 'QD'},
'summary': 'TEST JIRA PYTHON',
'description': 'test',
'issuetype': {'name': 'Bug'},
}
new_issue = ji.create_issue(fields=issue_dict)
def main():
jira_create_issue("test rest", "test rest1")
if __name__ == "__main__":
main()
Whenever creating an issue like this, I get an HTTP 400 error saying:
response text = {"errorMessages":["Epic Link Field is Empty !"],"errors":{}}
When I try to include the epic link field in issue_dict (I've tried many forms: epiclink, EpicLink, Epic Link, epic link, epic and so on...), I get the following error:
response text = {"errorMessages":[],"errors":{"Epic Link":"Field 'Epic Link' cannot be set. It is not on the appropriate screen, or unknown."}}
What am I doing wrong? When opening a task in out Jira dashboard manually, I do have an Epic Link field with a drop down to set. But what is the name of the key of it? It isn't written anywhere in the docs.
It turns out that
Epic Linkis a custom field added by my company, therefore it's "display name" is different from it's actual key.I found out that it's key was
customfield_10002by using the methodJIRA.fields()which returns a list of all issue fields. I then just searched usingctrl + FforEpic Link, and looked at it'skey.My final
issue_dictlooks like so:where
EPIC_LINK_FIELDis said key andQD-9913is the key of the epic link I need (can be found under the name of each epic link in the epic link dropdown).