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 and Groups
Custom fields can be selected using the "group name"."field name"
format. Whole custom field groups can be selected using the "group name"
format. For example, based on a snippet of Custom Fields metadata like:
{
...,
"SafetySecurity Features": { // group name
"Label": "Safety/Security Features", // group label, not to be confused with group name
"Fields": {
...,
"Fire Sprinkler": { // field name
"ResourceUri": "/v1/customfields/Fire Sprinkler",
"Label": "Some Field",
"HasList": false,
"MaxListSize": 0,
"Searchable": false,
"MlsVisible": ["A", "B", "C"],
"Type": "Character",
"FieldCategory": "Main"
},
...
}
},
...
}
We would construct _select="SafetySecurity Features"."Fire Sprinkler"
, which would result in:
{
"D": {
"Results": [
{
"CustomFields": [
{
"Main": [
{
"Safety Features": [
{
"Fire Sprinkler": true
}
]
}
]
}
],
"Id": "20041105212720749673000000",
"StandardFields": {
"MlsId": "20000809145531659995000000",
}
}
],
"Success": true
}
}
We could also choose to construct _select="SafetySecurity Features"
, which would result in the whole "Safety Features" group being returned:
{
"D": {
"Results": [
{
"CustomFields": [
{
"Main": [
{
"Safety Features": [
{
"Fire Sprinkler": true
},
{
"Escape Pod": true
},
{
"Smoke Screen": true
}
]
}
]
}
],
"Id": "20041105212720749673000000",
"StandardFields": {
"MlsId": "20000809145531659995000000",
}
}
],
"Success": true
}
}
Custom fields and groups can be selected alongside standard fields and expansions. An example of multiple selections with a mixed retrieval might look like:
_select=ListingId,"SafetySecurity Features"."Fire Sprinkler","Contract Information",Photos.Name
Note that if the value for a selected custom field is null for a listing, that custom field will be omitted from the CustomFields
payload for that listing, even when selected.
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