Filter tickets with value != null

Hey guys!

I’m looking on Filter Tickets on Freshdesk’s API and I can find an example that I can request tickets when a value is null. Something like this:

https://domain.freshdesk.com/api/v2/search/tickets?query=“type:null%20AND%20priority:4”

But I would like to request for tickets when a field is not null. This field has some different information, that’s why I would like to make this kind of request.

Do you know if it is possible?

Thank you.

Hey @omarcelo

In the case of Freshdesk APIs default values of some of the fields are null, so when the value of that field is set, it takes the new value, so here the value can be null or anything else.

The way Freshdesk filter works is that you can only filter based on the value of the field and not by its nature or attribute type, so in your case since the value of a ticket field cannot be explicitly not null because anything other than null is considered not null.

The work around you can do to achieve is, fetch all the tickets with that field and then filter it in your code by ignoring all the tickets with the value of the field == null which will get you all the other values that is not null

if you want to get any specific value, you can just substitute the value with null in your above example.

Hope this helps!

Stay Safe :slight_smile:

2 Likes