Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Using expand=renderedFields with Python

While trying to figure out how to access the parent field of an issue, I realized that the "parent" field doesn't come up with the URL https://{instancename}{issuekey} but it does come up for the URL https://{instancename}{issuekey}?expand=names or https://{instancename}{issuekey}?expand=renderedFields. Both of those URLs have a fields section that looks like this

Screen Shot 2022-08-11 at 10.45.50 AM.png

After realizing this, I added these lines of code, which are in a loop that loops through all the issues

myIssue = jira.issue(singleIssue.key, expand='renderedFields')

But it still says parent doesn't exist within myIssue, and I even printed all the fields of myIssue to check and parent wasn't there. Did I use expand incorrectly? Is there another way to access parent?

1 answer

Looks like you are using JIRA library to get values.

Please check with the version of that library OR maybe check some alternatives.

Also, just to check if fields ARE available, you could use very simple approach:

import requests

response = requests.get('https://{instancename}{issuekey}?expand=renderedFields')
result = response.json()

NOTE: For me jira library returned 'parent' just in fields, like

from jira import JIRA

jira_connection = JIRA(.... - <URL + Auth params>) 

issue = jira_connection.issue('some issue key')
parent_key = issue.fields.parent.key

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events