Filter collection entries by collection link

Hey

does anyone know how to filter collections / collection-entries by a collection link field (that is assigned to this collection)?

No matter how we try, we always get an server error, get redirected back to collection entry-overview or just get no results.

Simply filtering by “title” (for example) instead works pretty well:
So if our collection has the field “title” we can do:

?q={"page":1,"filter":{"title":"abc"},"sort":{"_created":-1},"limit":20}

and we get the entries that have “abc” within the title field as an result.

But when we try to filter by the collection-link field (the collection link field is called “categories”)) :

{"page":1,"filter":{"categories" : {"display" : "abc"}},"sort":{"_created":-1},"limit":20}

{"page":1,"filter":{"categories.display" : "abc"},"sort":{"_created":-1},"limit":20}

(I also tried “categories.link” … also no result)

we wont get any result at all.

We tried dozens of filter query strings but none brought desired results.


Perhaps there is even a better way (other then collection-links) of implementing a blog site that has categories for the posts/entries and should be filter/searchable by those categories?

get request:
https://url/to/cockpit/api/collections/get/test?token=xxtokenxx&filter[link.display]=test

post request:
{"filter":{"link.display":"test"}}

Avoid whitespaces and linebreaks in json bodies.

This should work. If not, have a look at

1 Like