IoTool REST API guidelines
These are the guidelines that will help you send external data to an IoTool server using the IoTool REST API.
URL
The subdomain of your IoTool server where you already have your IoTool database account should be used.
JSON
JSON readings can be only sent inside an array in the root of the HTTP body. Sensor, reading, and datetimems are all mandatory. Sensor should be named like this: reading_name@sensor_name. Reading should be a number. Use the dot "." as a decimal mark. Datetimems should be a timestamp of the reading in UNIX epoch time in seconds, followed by 3 digits for milliseconds
Sample code
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://<your_subdomain>.iotool.io/database/adminer/api/readings.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "[
{ \"sensor\": \"temperature@my_sensor\", \"reading\": \"1\", \"datetimems\": 1419876021778 }
,
{ \"sensor\": \"temperature@my_sensor\", \"reading\": \"2.3\", \"datetimems\": 1419876022778 }
,
{ \"sensor\": \"posture@my_sensor\", \"reading\": \"3\", \"datetimems\": 1419876023778 }
,
{ \"sensor\": \"temperature@my_sensor\", \"reading\": \"4\", \"datetimems\": 1419876024778 }
]");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"IoTool-Username: your_username",
"IoTool-Password: your_password",
"Accept-Version: ~0"
));