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
4,364,021
Community Members
 
Community Events
168
Community Groups

How do I filter custom fields with value null in URL query

Let's say I have a list of issues. But some of them have a custom field with value null in my json ("customfield_number":null), since it's optional. How can I filter issues with only non null custom field?

 

I tried

https://jira.company.com/rest/api/2/search?jql=project=key&maxResults=1000&customfield_number%21%3Dnull

 also 

https://jira.companyname.com/rest/api/latest/search?jql=cf%5Bnumber%5D%20is%20not%20EMPTY

But none of these affected the results, at all...

1 answer

1 accepted

1 vote
Answer accepted

The second url says "is not empty" but you are searching for null. Could it be you meant

 "customfield" IS EMPTY

instead?

 

Assuming that api/2/search jql param works the same way as typing it out to navigator (you can do the same with /issues/?jql= ..) then above should be working.

Also, it's part of the jql - not a separate parameter, so

?jql=project = <key> and cf[12345] is empty&maxResults=1000

 

Trying locally that seems to do the work.

I need to filter out values with null, I'm not searching for null. I need all issues where customfield is not null

If I try to modify the URL like above I get error code 400

 

EDIT: Thank you so so so much! It finally works after a day of failure, the way you said that customfield_nr is part of the jql query clicked something in me!! So my query looks like this

 

```search?jql=project=key+and+cf[id]+is+not+empty``` with plus signs in between

Suggest an answer

Log in or Sign up to answer