The distributed services behind the devices network, and the two requests that get the data of a device.
The topology behind all the systems that run our devices network is a distributed services architecture. It distributes functionality between resources in a decentralised way and connects all components – machines, hardware and software – into unified and adaptable data models.
A single device, for example an air quality station, may transmit a few hundred million records over its lifetime, so we are talking about really big data. To achieve scalability, low latency and high availability, we use an X-tier model with distributed endpoint services that host device data in different locations around the globe. This way the resources that receive data are close to the devices, and users' requests for data are answered with low latency.
The X-tier structure consists of one or more services (APIs) – usually a central service with the descriptive information, such as device parameters, user data, settings and permissions – and a data endpoint to which the device is connected and submits its data.
The recommended way is to first ask the central service for the device information, including the URLs of its data endpoint, and then to send the request to the data endpoint API where the data is hosted.
Request 1: get the device. Fetch the device information, including the token of the device and the URL of its data endpoint. You need them for the next request.
curl -X GET \
https://open-data.senstate.cloud/devices/MY-DEVICE-TOKEN
Example response:
{
"token": "MY-DEVICE-TOKEN",
"dataEndpoint": {
"name": "SEE Endpoint",
"deviceURL": "https://see.senstate.cloud/data/{Token}",
"channelDataURL": "https://see.senstate.cloud/data/{Token}/channel/{channel}"
}
}
The device information comes from the Open Data Services API. Read more in its reference (the Swagger definition at the address of the API).
Request 2: get the data. With the data endpoint URL from the previous request, send the request with the parameters of the device, such as its token or other parameters that might be required.
curl -X GET \
https://see.senstate.cloud/data/MY-DEVICE-TOKEN
The device data comes from its data endpoint API. Read more in the reference of the data endpoint services (the Swagger definition at one of our data endpoints).