πRequests from Consumers
Format
Resource Reducer accepts 2 query params:
_f
_fields
In both formats:
_f=id,name,created_at,role.name,role.permissions.name
or
_fields[]=id
_fields[]=name
_fields[]=role.name
It is not recommended to look up more than 3+ relationship levels.
If that happens, consider splitting them into another endpoint to lower your DB workload.
Request
Let your API consumers (Frontend, Mobile,...) know that you are supporting _f
and _fields
, so they can get enough data from their context
GET v1/users?_f[]=id&_f[]=name // for user dropdown
GET v1/languages?_fields=id,code,name // for language dropdown
POST v1/articles?_fields=id,slug // after created, we only need id and slug to redirect
Last updated