You can control which fields are returned from the JSON:API content delivery API by providing the fields
parameter.
The following example will retrieve a specific book, ensuring that only the title
,publishedData
and author
fields are returned.
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book?fields[book]=title,publishedDate,author \
-H 'Content-Type: application/vnd.api+json'
If you want to control the fields that are returned by a relationship, you must configure sparse fieldsets for the resource type that will be returned by the relationship.
The below example extends the previous one, by configuring sparse fieldsets for the author
resource type. This ensures that only an authors name is returned as part of the author
relationship.
curl https://{SPACE_ID}.spaces.lexascms.com/delivery/jsonapi/book?fields[book]=title,publishedDate,author&fields[author]=name \
-H 'Content-Type: application/vnd.api+json'
© 2022 Status200 Ltd.