Use Case
For mobile device usecases, a restricted number of fields returned enables the implementer to minimise data transfer.
References
Proposal
The fields keyword is reserved to allow for the restriction of properties returned in the response.
/sessions?fields=name,startDate,subEvent[1].startDate,subEvent[1].endDate
- A list of properties to be included, using dot notation
- Add limits to the number of items returned for properties where an array is available (note the limits are per-field, to allow the first item to contain more fields than subsequent items).
- If an object is specified without specific fields (e.g. location.address) return the whole object.
Examples
/sessions?fields=name,activity,location.address,offers.name,offers.price,offers.priceCurrency
"items": [
{
"name": "Example Leisure Centre Table Tennis",
"activity": "Table Tennis",
"location": {
"address": {
"type": "PostalAddress",
"streetAddress": "1 High Street",
"addressLocality": "Bristol",
"postalCode": "BS1 4SD"
}
},
"offers": [
{
"name": "30 minute hire",
"price": "10",
"priceCurrency": "GBP"
},
{
"name": "60 minute hire",
"price": "10",
"priceCurrency": "GBP"
}
]
}
]
/sessions?fields=name,activity,location.address.postalCode,offers[1].price,offers[1].priceCurrency,offers[2].name
"items": [
{
"name": "Example Leisure Centre Table Tennis",
"activity": "Table Tennis",
"location": {
"address": {
"postalCode": "BS1 4SD"
}
},
"offers": [
{
"name": "30 minute hire",
"price": "10",
"priceCurrency": "GBP"
},
{
"name": "60 minute hire"
}
]
}
]
Use Case
For mobile device usecases, a restricted number of fields returned enables the implementer to minimise data transfer.
References
Proposal
The
fieldskeyword is reserved to allow for the restriction of properties returned in the response./sessions?fields=name,startDate,subEvent[1].startDate,subEvent[1].endDateExamples
/sessions?fields=name,activity,location.address,offers.name,offers.price,offers.priceCurrency/sessions?fields=name,activity,location.address.postalCode,offers[1].price,offers[1].priceCurrency,offers[2].name