statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
30 stars 1 forks source link

REST API: enable `fields` query param for api/collections/:collection/entries/:entry endpoint #1078

Open BrandonOldenhof opened 7 months ago

BrandonOldenhof commented 7 months ago

The fields query param works for REST API index routes, but not for single entry routes:

The Statamic docs seem to hint at it working because it doesn't mention a specific type of endpoint https://statamic.dev/rest-api#selecting-fields:

Selecting Fields

You may specify which top level fields should be included in the response. /endpoint?fields=id,title,content

It would be great if this could be implemented; my page entries tend to have a lot of fields, making the JSON payloads a lot larger than they need to be. The larger datasets take longer for decoupled frontends to download, making them a bit slower.

Discord thread: https://discord.com/channels/489818810157891584/1175070103499448372