Overview
The query node is meant to return all items (alongside the specified attributes) that match the provided query. A query operation is always executed on ONE dodi code.
Additionally, since the amount of requested data might be very large, you can filter on the attributes of items within the data. If you do not specifiy any attributes, only the basic item information will be returned. If you specify attributes only that data will be returned in the response. It is also possible to use the All
keyword to request all the attributes.
Always request only what you need, because the gain in terms of performances and reduced system strain can be massive, even if just one attribute is removed.
Examples
This is an example of a simple Query that lists all the items and the basic design details for each item.
{
"type": "Query", // "The root node type"
"properties": {
"dodiCode": "designs_streetLights" // This can be a design or design interface.
}
}
This is an example of a query that includes all the attributes for all the items listed. The list is also sorted by unit number.
{
"type": "Query",
"properties": {
"dodiCode": "designs_streetLights", // This can be a design or design interface.
"attributes": ["all"], // This would include all the attributes for every item associated with the design.
"sortInfo": {
"attributeCode": "attributes_streetLightingUnitsUnitNumber",
"sortOrder": "ascending"
}
}
}
This is an example of a query where the amount of data is minimised to one attribute of all the items listed. The list is also sorted by unit number.
{
"type": "Query",
"properties": {
"dodiCode": "designs_streetLights", // This can be a design or design interface. As we have not included any attributes, then only the basic design attributes are displayed.
"attributes": ["attributes_streetLightingUnitsUnitNumber"]
"sortInfo": {
"attributeCode": "attributes_streetLightingUnitsUnitNumber",
"sortOrder": "ascending"
}
}
}
This is an example of a query where the output contains only the Unit number and Controller attributes. The list is also sorted by unit number.
{
"type": "Query",
"properties": {
"dodiCode": "designs_streetLights", // This can be a design or design interface.
"attributes": ["attributes_streetLightingUnitsUnitNumber","attributes_streetLightingUnitsControllers"], // This would include only the Unit number and Unit Controller attributes for every item associated with the design.
"sortInfo": {
"attributeCode": "attributes_streetLightingUnitsUnitNumber",
"sortOrder": "ascending"
}
}
}