Note: This documentation refers to Gravio 3.8 or older. For Gravio 4 or newer, please refer to the respective documentation on doc.gravio.com . |
In order to send data reading information to third party servers, Hubkit provides a set of API endpoints which can be used to register and receive data readings right when they get processed by HubKit.
API Endpoints
For all POST request, the expected Body content is a JSON string containing the URL HubKit should try and send data to.
For example, a request to https://127.0.0.1:29443/readingSubscriber/subscribe
should have a Body similar to "https://en5lqsyl9wsws.x.pipedream.net/"
and a valid Content-type: application/json; charset=utf-8
header
POST | https://HubKitAddress:29443/readingSubscriber/subscribe |
API endpoint to add or reactivate a reading Subscriber |
---|---|---|
POST | https://HubKitAddress:29443/readingSubscriber/unsubscribe |
API endpoint to remove a reading Subscriber |
POST | https://HubKitAddress:29443/readingSubscriber/isRunning |
API endpoint to check if a reading Subscriber is active or not |
Data Reading Format
The format is similar to what you can see in Gravio Studio Data Viewer and has the following structure:
AreaName | string | Name of the Area, the sensor is registered in ex: “Area 1” |
---|---|---|
LayerName | string | Name of the Layer, the sensor is registered in ex: “Layer 3” |
DeviceName | string | Name, custom or default, the sensor is registered as ex: “EnOcean” (default) or “Door Sensor 1” (custom) |
LayerType | string | Name of the category that reading is ex: “Gravio-Door-JP” |
DataType | string | Name of the data type that reading is ex: “Contact status” |
SenderId | string | ID/MAC Address of the sensor ex: “05-00-0A-3D” |
Data | object | Usually number or string – Parsed data ex: “Contact open” (string) or 24.408 (number) |
Timestamp | string | ISO 8601 formatted string of the UTC time the reading was received by Hubkit at |
DataId | string | Unique Uuid of that data reading, for database storage purposes |
How to Test the API
Subscribe to your endpoint, e.g. on RequestBin.com if you don’t have an Endpoint yet:
Activate a sensor, and you should see the incoming data on your Endpoint: