Skip to main content

Query node

How to use the Query node

The Query node lists qualifying items of a single design/interface that fulfil the conditions of the given query, along with their attribute data.

By default, all attributes are returned for the listed items. However, since the amount of requested data might be large, your query can request specific attributes instead.

Additionally, only items from the Live collection are included by default. However, you can specify one or more collections to use if required.

Note

The more attributes you request, the more data has to be processed. Therefore, for optimal performance, please only request attributes that are meaningful to your query.

Examples

Simple Query

This query lists the Live items of the Street Lights design and all their attributes.

{
"type": "Query", // The root node type
"properties": {
"dodiCode": "designs_streetLights", // Specify a design or interface.
"collectionCode": "Live", // Only list items of the Live collection (default if not specified)
"attributes": ["all"] // Return all attributes for the listed items (default if not specified)
}
}
Minimal Query

This query lists the Live and Archive items of the Street Lights design. To minimise data processing, it only returns a single attribute for the listed items.

{
"type": "Query",
"properties": {
"dodiCode": "designs_streetLights", // Specify a design or interface
"collectionCode": ["Live", "Archive"], // You can specify multiple collections in an array
"attributes": ["attributes_streetLightingUnitsUnitNumber"]
}
}
Filtered Query

This query lists all items of the Street Lights design. It returns two attributes for the listed items and sorts the list by Unit Number.

{
"type": "Query",
"properties": {
"dodiCode": "designs_streetLights", // Specify a design or interface
"collectionCode": [], // To include items from all collections, specify an empty array
"attributes": [
"attributes_streetLightingUnitsUnitNumber",
"attributes_streetLightingUnitsControllers"
], // Only include the Unit Number and Unit Controller attributes for each item
"sortInfo": {
"attributeCode": "attributes_streetLightingUnitsUnitNumber",
"sortOrder": "ascending"
}
}
}