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}.atlassian.net/rest/api/latest/issue/{issuekey} but it does come up for the URL https://{instancename}.atlassian.net/rest/api/latest/issue/{issuekey}?expand=names or https://{instancename}.atlassian.net/rest/api/latest/issue/{issuekey}?expand=renderedFields. Both of those URLs have a fields section that looks like this
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')
parentsummary.append(myIssue.fields.parent)
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?
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}.atlassian.net/rest/api/latest/issue/{issuekey}?expand=renderedFields')
result = response.json()
print(result['fields']['parent'])
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.