The topology behind all the systems that run our devices network is the Distributed Services Architecture. It is a powerful concept that enables distributing functionality between resources in a decentralized manner and connecting all components, including machines, hardware and software into a unified and adaptable data models.
Since even a single device, for example and Air Quality Station might transmit a few hundred of millions of records though its operation lifetime, we speak about really big data. And for the objectives of achieving scalability, low latency and high availability, we are using X-tier model with distributed Endpoint services that host device data on different locations on the globe. With such concept, data submission resources are close to the devices pool and data retrieval requests from users are with low latency for better user experience.
X-tier Structure
The X-tier structure consist of one or more services (API’s), usually the central service that contain descriptive information, such as device parameters, user data, settings, permissions etc. and a Data Endpoint where the device is connected and submits the data.
A recommended way for doing requests is to make a request from the central service to obtain the device information, including the Endpoint URLs of the endpoint and then to initiate request to the Data Endpoint APIs, where data is hosted at.
Example request structure
Request 1: Get Device, fetching device information, including the Token of the device and its Data Endpoint URL. This data is used for the next request.
Example Request
curl -X GET \
https://open-data.senstate.cloud/devices/MY-DEVICE-TOKEN
Example response
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}"
},
}
Device information should be consumed from the Open Data Services API. You can read more about the Open Data Services API, view the Reference hosted in this documentation or directly browse the Swagger definition at the API address https://open-data.senstate.cloud/api-reference/index.html
Request 2: Get Data. Once we have the Data Endpoint URL from the previous request, we just initiate the request with the corresponding device parameters, such as its Token or other parameters that might be required.
Example Request
curl -X GET \
https://see.senstate.cloud/data/MY-DEVICE-TOKEN
Device data should be consumed from the respective Data Endpoint API. You can read more about the Endpoint Data Services API, view the Reference hosted in this documentation or directly browse the Swagger definition at one of our Data Endpoints at https://see.senstate.cloud/api-reference/index.html
Roadmap
In v.2, there is a planned implementation of a Gateway service, that would simplify the X-tier request structure. You will be able to directly access all data from the Open Data API interfaces, but behind the scene, the Open Data API will initiate requests to the specific Data Endpoint where the device is connected to. In this case, for you as API consumer, process will be simpler, but for the price of bigger latency. Please check the roadmap for further information.