Search code examples
jirajira-rest-apijql

JIRA and JQL: How can I filter results where custom fields are not empty?


I'm working on a get request that gives me all JIRA issues with the custom field "Sponsor". Since it's an optional field, the value is often empty. So out of all issues in a JIRA project, how can I extract those who have a sponsor? My query looks like this so far

https://jira.companyname.com/rest/api/2/search?jql=project=projectname&maxResults=1000

What is missing? I do know the customField name and id.

I tried

jql=project=projectname&maxResults=1000&customfield_number!%3DEMPTY

and

jql=project=projectname&maxResults=1000&customfield_number!%3Dnull

But it didn't work


Solution

  • Try is not EMPTY in your JQL query, rather than != null or !=EMPTY.

    Substitute number for your custom field number and try this request URL: https://jira.companyname.com/rest/api/latest/search?jql=cf%5Bnumber%5D%20is%20not%20EMPTY