Page Contents
A fields filter specifies properties (fields) to include or exclude from the results.
REST API
filter[fields][_propertyName_]=<true|false>&filter[fields][propertyName]=<true|false>...
Note that to include more than one field in REST, use multiple filters.
You can also use stringified JSON format in a REST query.
Node API
Warning:
Methods of models in the AngularJS client have a different signature than those of the Node API.
For more information, see AngularJS SDK API.
{ fields: {_propertyName_: <true|false>, _propertyName_: <true|false>, ... } }
Where:
- propertyName is the name of the property (field) to include or exclude.
-
<true false> signifies either true
orfalse
Boolean literal. Usetrue
to include the property orfalse
to exclude it from results.
By default, queries return all model properties in results. However, if you specify at least one fields filter with a value of true
,
then by default the query will include only those you specifically include with filters.
Examples
Return only id
, make
, and model
properties:
REST
?filter[fields][id]=true&filter[fields][make]=true&filter[fields][model]=true
{ fields: {id: true, make: true, model: true} }
Returns:
[{
"id": "1",
"make": "Nissan",
"model": "Titan"
}, {
"id": "2",
"make": "Nissan",
"model": "Avalon"
},
...
]
Exclude the vin
property:
REST
?filter[fields][vin]=false
{ fields: {vin: false} }