I am using Jira API with Python to loop through issues (which are all tasks) and have been referencing their fields (like singleIssue.fields.summary, singleIssue.fields.created, etc). I can't however figure out how to get the parent/epic of the task. It seems like parent should be a field of each issue, but when I display the fields (singleIssue.raw['fields']), parent or epic isn't one of them. Is there anything I am missing here or another way to find the parent of an issue with Python?
The hierarchy is a bit of a mess in Jira, for historical reasons I won't bore you with. Atlassian are currently trying to improve it, but it's not quite there yet.
Part of it is because of the two styles of project there are. Both see "Epic -> Issue -> Sub-task" as the core hierarchy, but:
Atlassian are moving the REST APIs to hide the complexities of CMPs here, and you will soon be able to just say "parent/child" and not have to worry, but for now, you do need to look at the project type to work out what you should be asking for!
Have you tried parentID or parent.id?
You can see all of the fields on an issue by typing this in a browser. (I also have a browser extension that makes the JSON pretty.):
https://{instancename}.atlassian.net/rest/api/latest/issue/{issuekey}
When I do that for a Story related to an Epic, I see this in the results:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for your response! When I look at https://{instancename}.atlassian.net/rest/api/latest/issue/{issuekey}, I don't see any fields related to "parent" or "epic", but when I look at https://{instancename}.atlassian.net/rest/api/latest/issue/{issuekey}?expand=names I see a parent field with id, key, summary, and more. I'm new to this so this may be an obvious question, but what does the ?expand=names in the URL do and how would I access those fields in my loop?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.