core
core copied to clipboard
API - /api/contents - filter by taxonomies
Hi, would there be an option in api to filter by taxonomies?
@ApiFilter(SearchFilter::class, properties={ "id": "exact", "contentType": "exact", "status": "exact", "createdAt": "exact", "publishedAt": "exact", "depublishedAt": "exact", "taxonomies.id": "exact", "taxonomies.slug": "exact", })
It's a bit quirky but you can decorate Bolt\Api\Extensions\ContentExtension
and use the ContextAwareQueryCollectionExtensionInterface
, which will pass context
in applyToCollection
method, allowing you to retrieve filters from this parameter and then apply it to the query builder.