ideas icon indicating copy to clipboard operation
ideas copied to clipboard

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

Open BrandonOldenhof opened this issue 2 years ago • 0 comments

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

  • Works: api/collections/:collection/entries?fields=title,slug
  • Doesn't work: api/collections/:collection/entries/:entry?fields=title,slug

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

BrandonOldenhof avatar Nov 17 '23 14:11 BrandonOldenhof