Basically I want the same thing as mentioned here, How to filter fields on API response, but for Cockpit v2.
The old solution was to add the parameters to the request body like so:
{
"fields": {
"slug": true,
"_id": false
}
}
But this doesn’t seem to work anymore.
The docs state that you have to use Mongo Query syntax now. So I’ve tried just that by moving the fields
to the requests parameters:
GET COCKPIT_HOST/api/pages/pages?fields={"title": true}
I’d expect the response to contain an array with just one field, title
, per entry.
But I still get all fields in the response.
What’s the right way of doing this now in v2
Thanks in advance