Python API query by list item's key

Igor Pozdnyakov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2023

I query for an issue(s) using customfileds 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.

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?

1 answer

0 votes
Mohamed Benziane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 20, 2024

Hi,

Welcome to the community,

The field customfield_456 is a Asset field ?

Suggest an answer

Log in or Sign up to answer