Partial retrieval returns only selected fields from a resource or collection instead of its complete representation. It matters when resources are large, clients have limited hardware, or connectivity makes unnecessary data costly; even small additions multiply across large lists. section 8.1.1
Field masks provide the usual mechanism: a collection of field paths identifies the data a get operation should return. Nested fields and map keys can be addressed, but array elements should not be selected by position or index. section 8.2 section 8.6
Selecting fields from a resource
A client retrieving a large ChatRoom can request only the fields it needs rather than receiving every field. If it needs a nested value, it identifies that path in the field mask; a map entry such as settings["hello.world"] can likewise be addressed without requesting the entire map. section 8.5 section 8.2
Use partial retrieval with these rules:
- Support it consistently across all resources if the API supports it at all; resource-specific behavior makes standard get methods surprising. section 8.4.1
- Return all fields when a retrieval mask is omitted, except for exceptionally large or expensive fields that are explicitly documented as opt-in. section 8.3.4
- Treat field masks as a data-transfer control, not as a SQL-like relationship query; use a relationship-oriented query system such as GraphQL when joining related resources is the real need. section 8.4
Shows how a field mask specifies the fields returned during resource retrieval. section 8.2
