Sparse Fieldsets

Our API supports a subset of the json:api spec, including sparse fieldsets.

As noted in the json:api spec:

Apps can request that an endpoint return only specific fields in the response on a per-type basis by including a fields[TYPE] parameter.

The value of the fields parameter MUST be a comma-separated (U+002C COMMA, “,”) list that refers to the name(s) of the fields to be returned. An empty value indicates that no fields should be returned.

An example:

GET /api/advice?fields[variables]=id,value&fields[adviceset]=

Returns only id and value for the variables list.

(numerous properties removed for legibility)

{
  ...
  variables: {
    id: "UvxxJixuNroAdoyKT6y2B",
    value: true
  }
}

Note the request specified an empty list for the adviceset field. Our API will not return any fields for that property nor the adviceset property itself.


What’s Next