Jira Python API query by value in a list

66 Views Asked by At

I query for an issue(s) using customfields values, e.g.

query = { 
   'jql': 'customfield_123 ~ "pattern"'
}
response_tickets = requests.request(
    "GET",
    url,
    headers=headers,
    params=query,
    auth=basic_auth,
    timeout=15
)

It works. In the output I have this customfield:

"customfield_456": [
     {
         "workspaceId": "35bc4381-e5bb-4e45-8ac3-6248aaea6b13",
         "id": "35bc4381-e5bb-4e45-8ac3-6248aaea6b13:4444",
         "objectId": "4444"
     }
 ],

Instead of the query above I need to query by a key of a list's item, in this case I need to specify list's first item's objectId value ( "4444" ) somehow to get the issue This below and several variation (including quoting and encoding) did not work. Does not give an error either.

value = "4444"
query = { 
    'jql': f"customfield_456[0].objectId ~ '{value}'"
}

This query does not find the issue. What's jql way to specify customfield_456[0].objectId in the query? P.S. I have the actual value of customfield_456[0].objectId for the input so I don't mind to use equal sign instead of tilde, but it does not work either.

0

There are 0 best solutions below