Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-273

Allow requests for a restricted set of fields (sparse fieldsets)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None

      Citing: https://jsonapi.org/format/#fetching-sparse-fieldsets

      A client MAY 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.

      If a client requests a restricted set of fields for a given resource type, an endpoint MUST NOT include additional fields in resource objects of that type in its response.

      If a client does not specify the set of fields for a given resource type, the server MAY send all fields, a subset of fields, or no fields for that resource type.

      GET /articles?include=author&fields[articles]=title,body&fields[people]=name HTTP/1.1 Accept: application/vnd.api+json

      Examples: https://jsonapi.org/examples/

        Acceptance criteria

              Unassigned Unassigned
              mdrapela Martin Drápela
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD