Contentful logo

Contentful Community

Search on Contentful for null/not null fields

Hi there,

On Contentful website, I would like to filter by a field that is/is not null.
Is that possible?

7 Likes

Hi @kennedy,

This is not a possibility directly through our Web Interface, but you could do that using our Delivery or Management APIs with the existence parameter:

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/existence

That’s something I’ve needed on a number of occasions too and have previously enquired about. @gabriel is it it a query you get a lot and is there any prospect of it making it onto the UI roadmap?

6 Likes

Any chance this will be implemented in the future? I’ve had a lot of use cases for this… :confused:

BTW, for anyone getting here via a desperate google search, here’s my workaround:

  • Open the content panel in the contentful web view
  • Filter for the content type in question (e.g. clients)
  • Open Dev Tools
  • Go to network tab
  • Look for the corresponding entries request (should have content_type={client} as URL param)
  • Right click -> Open the request in a new tab
  • Add &{field you want to filter}[exists]=true to the URL params

In the end, your URL should look something like this:
https://api.contentful.com/[...]/entries?content_type=client&access_token={access token}&fields.company[exists]=true (where client and company are examplary values)

BTW you can get an access token for this kind of request from the authorization request header of the entries request (omit the Bearer keyword)

4 Likes

Hi @lukas.mueller, @scott.hogan. Since it seems this feature is interesting, I will forward this request to our Product team and keep you updated in this post.

9 Likes

Any updates on if this has been implemented in the web UI?

1 Like