Limiting Fields

Sometimes, when retrieving large amounts of data, you want to limit the data returned from the server to speed up performance.

If you want to remove unnecessary fields from the serialization and only return specific fields, you can use the fields query parameter:

List Locations, but limit the serialized fields to only name and notes

/api/projects/locations/?fields=name,notes

The above example will return results like

{
    "name": "Zefram's House",
    "notes": "Warp or bust"
}

You can also add new synthetic fields with the fields parameter:

List Locations, limit the default serialized fields to only name and notes, and add the Site's name field

/api/projects/locations/?fields=name,notes,site__name

Which will return something like

{
    "name": "Zefram's House",
    "notes": "Warp or bust",
    "site__name": "Bozeman, MT"
}