Data queries
Query data by location, time, numeric range and text.
These examples document the original platform. Use your own deployment; this website does not provide the former hosted API or account service.
The following is a list of different types of data queries supported by servIoTicy:
geodistance: Search for Updates within a given distance of a given coordinate. Incompatible with GeoBoundingBox. Requires a location channel (in GeoJson format) to exist, which will be used to keep the location of the sensor updates.
Example payload:
{
"geodistance": true,
"geodistancevalue": 300,
"pointlat": 43.15,
"pointlon": 15.43,
"geodistanceunit": "km"
}
geoboundingbox: Search for Updates within a geo fence. Incompatible with GeoDistance. Requires a location channel (in GeoJson format) to exist, which will be used to keep the location of the sensor updates.
Example payload:
{
"geoboundingbox": true,
"geoboxupperleftlat": 15.43,
"geoboxupperleftlat": 43.15,
"geoboxbottomrightlat": 47.15,
"geoboxbottomrightlon": 15.47
}
timerange: Search for Updates with a lastUpdate field value within a range of timestamps.
Example payloads:
{ “timerange”: true, “rangefrom”: 1396859660, “rangeto”: 1396859760 }
{
"timerange": true,
"rangeto": 1396859760
}
{
"timerange": true,
"rangefrom": 1396859660,
}
numericrange: Search for Updates with a given field value within a range of values.
Example payloads:
{
"numericrange": true,
"rangefrom": 13,
"rangeto": 17,
"numericrangefield": "channels.age.current-value"
}
{
"numericrange": true,
"rangefrom": 13,
"numericrangefield": "channels.age.current-value"
}
{
"numericrange": true,
"rangeto": 17,
"numericrangefield": "channels.age.current-value"
}
match: Search for Updates that match in any of its fields with the terms listed (any of them)
Example payloads:
{
"match": true,
"matchfield": "channels.name.current-value",
"matchstring": "Peter John",
}
Example of complex query that restricts:
- Field
channels.age.current-valuebetween 13 and 17 lastUpdateof the items above 1396859660- Containing the terms “John” or “Peter” in the field
channels.name.current-value - Located within a GeoFenc
Corresponding payload:
{
"numericrange": true,
"rangefrom": 13,
"rangeto": 17,
"numericrangefield": "channels.age.current-value",
"timerange": true,
"rangefrom": 1396859660,
"match": true,
"matchfield": "channels.name.current-value",
"matchstring": "Peter John",
"geoboundingbox": true,
"geoboxupperleftlat": 15.43,
"geoboxupperleftlat": 43.15,
"geoboxbottomrightlat": 47.15,
"geoboxbottomrightlon": 15.47
}
