OGC SensorThings API
Last updated
Last updated
The OGC SensorThings API is a standard specification aiming to simplify and standardise the integration and communication of Internet of Things (IoT) sensor data. It enables seamless interoperability between different systems, devices, and applications by providing a unified way to access and share sensor data over the internet. This API is particularly useful for real-time data exchange and monitoring tasks in diverse and distributed sensor networks.
Environmental monitoring application
Imagine an environmental monitoring application that collects data from various sensors deployed in a city. This application can utilise the OGC SensorThings API to access real-time data from sensors measuring air quality, temperature, humidity, and noise levels. By making API requests, the application:
Retrieves current air quality indexes from different areas within the city.
Gathers temperature and humidity readings to monitor weather conditions.
Accesses noise level data to identify and address noise pollution hotspots.
This API enables the application to provide citizens and city officials with up-to-date environmental information, supporting better decision-making and urban planning.
Retrieves all Things available on the server. A $filter
expression can be applied for selective querying (e.g., filtering by name or description).
Example Filter Expression:
name eq 'WeatherStation1'
Retrieves detailed information about a single Thing by its ID, including its associated Locations
and HistoricalLocations
.
Updates the specified properties of an existing Thing. Possible updatable properties include:
name
(String): The name of the Thing.
description
(String): Description text.
properties
(Object): Additional metadata.
Deletes a Thing identified by its ID.
Associates one or more Location entities to a Thing.
Removes all Location links from a Thing.
Creates a new Location.
Options:
name
(String): Name of the Location.
location
(Object): Geospatial data in the format of encodingType
.
description
(String): Description of the Location.
properties
(Object): Custom attributes.
encodingType
(String): Defaults to 'application/geo+json'
.
You may also link this Location directly to existing Things by providing their IDs.
Retrieves all Locations. Supports $filter
expressions (e.g., name eq 'SiteA'
).
Retrieves a specific Location by ID.
Updates an existing Location’s properties:
name
description
properties
location
encodingType
deleteLocation
Deletes a Location by ID.
showLocationHistory
Returns the historical Locations of a Thing, aggregated over time based on a specified property found in the properties
field of each Location.
Creates an ObservedProperty.
Required options:
name
(String): Name of the ObservedProperty.
Optional options:
description
(String): Description.
properties
(Object): Custom metadata.
definition
(String): URI of a controlled vocabulary term.
Retrieves all ObservedProperties. Supports $filter
expressions (e.g., name eq 'Temperature'
).
Fetches a single ObservedProperty by ID.
Updates an existing ObservedProperty’s properties.
Deletes an ObservedProperty by ID.
Creates a Sensor entity.
Required options:
name
(String): Name of the Sensor.
Optional options:
description
(String)
properties
(Object)
encodingType
(String): MIME type, e.g., application/pdf
.
metadata
(String): Metadata URI.
Retrieves all Sensors. Supports $filter
expressions.
Fetches a Sensor by ID.
Updates a Sensor entity.
Deletes a Sensor by ID.
Creates a Datastream entity.
Required options:
name
(String)
observationType
(String): URI or identifier of the observation type (e.g., http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement
).
unitOfMeasurement
(Object): Must include:
name
(e.g., 'Degree Celsius'
)
symbol
(e.g., '°C'
)
definition
(URI string)
thingId
(Integer)
sensorId
(Integer)
observedPropertyId
(Integer)
Optional options:
description
(String)
Retrieves all Datastreams. Supports $filter
expressions.
Fetches a specific Datastream by ID.
Updates an existing Datastream.
Deletes a Datastream by ID.
Creates an Observation.
Required options:
result
(any type): The value/result of the observation.
phenomenonTime
(String, ISO 8601 format): Timestamp of the observation.
Also requires:
datastreamId
(Integer)
Retrieves all Observations. Supports $filter
expressions (e.g., phenomenonTime ge 2024-01-01T00:00:00Z
).
Fetches a specific Observation by ID.
Updates an Observation entity.
Deletes an Observation by ID.
For flexibility, raw request methods are also provided:
getRaw
postRaw
patchRaw
deleteRaw
These allow direct URL access to the API for custom operations.
All IDs refer to @iot.id
properties from SensorThings resources.
All date/time values follow ISO 8601.
For geospatial data in Locations, the standard GeoJSON
format is recommended (encodingType: 'application/geo+json'
).
Many get*
methods support OGC-compliant , such as: