Selections
The _select
parameter allows you to specify the top-level data components you need. For larger data sets, such as listings, using this parameter will greatly reduce data retrieval time.
Parameter | Description |
---|---|
_select |
A comma separated list specifying the attributes to be returned in the response payload. |
While _select
applies to top-level attributes for most services, a notable exception is the
Listings API. For listings, _select
applies both to
StandardFields
and CustomFields
attributes. Also, many expansions support selecting
expansion attributes. Consult the expansion table for resources to find expansions that support this feature.
For example, passing the _select=ListingId
parameter to /<API Version>/listings
will cause only the StandardFields.ListingId
attribute to appear:
{
"D": {
"Success": true,
"Results": [
{
"ResourceUri": "/vX/listings/20060412165917817933000000",
"Id": "20060412165917817933000000",
"StandardFields": {
"ListingId": "10-1796"
}
}
]
}
}
Multiple Selections
Multiple selections can be specified with a comma separated list:
_select=ListingId,MlsStatus
Selecting Custom Fields
Custom fields can be selected using the group.field format. For example _select=\"Safety Features\".\"Fire Sprinkler\"
would result in:
{
"D":{
"Results":[
{
"CustomFields":[
{
"Main":[
{
"Safety Features":[
{
"Fire Sprinkler":true
}
]
}
]
}
],
"Id":"20041105212720749673000000",
"StandardFields":{
"MlsId":"20000809145531659995000000",
}
}
],
"Success":true
}
}
Custom fields can be selected along side standard fields and expansions. An example of multiple selections with a mixed retrieval would look like:
_select=ListingId,\"Safety Features\".\"Fire Sprinkler\",Photos.Name
Selecting on Expansion Attributes
For expansions that support the feature, selections on expansion attributes can be made by namespacing the expansion and the attribute with a period:
_select=Photos.Uri800,Photos.Name
Expansion attributes may be limited in number (currently only supported for photos). For example, if only the first 5 photos were desired, that may be specified by passing a modifier to the expansion:
_select=Photos(5)
Expansion attributes may also be limited by filter (also only supported for photos).
The below example shows how this can be used to only return listing
photos that have the 'Room.Living' Tag
:
_select=Photos(_filter=Tags Eq 'Room.Living')
These also work with the attribute namespaces as shown above:
_select=Photos(5).Uri800,Photos.Name
_select=Photos(_filter=Tags Eq 'Room.Living').Uri800