jsonapi-serializers
jsonapi-serializers copied to clipboard
Specify which attributes to include
In some circumstances I don't want to include all attributes. For example, when getting a list of users I don't want to include auth_token, but when logging in, the auth_token is required. Is this possible?
You need to follow JSONAPI specs http://jsonapi.org/format/#fetching-sparse-fieldsets
Spec means that you always return the widest available/defined fieldset, and client MAY shrink list of required fields, but DOES NOT HAVE TO specify them