HTTP / HTTPS
Send and read data with GET or POST requests and JSON replies.
Simple APIs designed for microcontrollers: one URL, a device key and a few parameters.
Send and read data with GET or POST requests and JSON replies.
Publish and subscribe through your MQTT.one broker for instant commands.
Receive signed notifications on your own server when something happens.
Register for free and confirm your email address.
Add a switch, sensor, tank or tracker, then open its key icon to copy the unique ID and secret key.
Use the examples below in your sketch or test them in your browser.
The base address of API version 1 is http://api.iotbind.com/v1 (HTTPS is supported). Every request carries these parameters, either in the query string (GET) or as form fields (POST):
| Parameter | Description |
|---|---|
method | "get" or "post": how the parameters are sent. Always required. |
key | The secret API key of the device. Always required. |
uid | The unique ID of the device. Always required. |
Keep the device key secret. If it leaks, generate a new one from the device key icon: the old key stops working at once.
Turn a switch on or off, store up to three values, or read its current state.
GET | POST http://api.iotbind.com/v1/switch.php
| Parameter | Description |
|---|---|
cmd |
Optional command: onoffgetping |
data1 |
Optional text or number to store. |
data2 |
Optional text or number to store. |
data3 |
Optional text or number to store. |
http://api.iotbind.com/v1/switch.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=on&data1=24.5&data2=OK
{"MESSAGE":"UPDATED"}http://api.iotbind.com/v1/switch.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
"uid": "UNIQUE_ID", "name": "Living room", "type": "RGB Light", "cmd": "on",
"data1": "24.5", "data1_unit": "C", "data2": "OK", "data2_unit": "", "data3": "", "data3_unit": ""
}
The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}
Store up to three readings, or read the latest values.
GET | POST http://api.iotbind.com/v1/sensor.php
| Parameter | Description |
|---|---|
cmd |
Optional command: getping |
data1 |
Optional text or number to store. |
data2 |
Optional text or number to store. |
data3 |
Optional text or number to store. |
http://api.iotbind.com/v1/sensor.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&data1=23.4&data2=41&data3=1012
{"MESSAGE":"UPDATED"}http://api.iotbind.com/v1/sensor.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
"uid": "UNIQUE_ID", "name": "Greenhouse", "type": "Temperature",
"data1": "23.4", "data1_unit": "C", "data2": "41", "data2_unit": "%", "data3": "1012", "data3_unit": "hPa"
}
The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}
Store the tank level and temperature, switch its pump, or read its state.
GET | POST http://api.iotbind.com/v1/tank.php
| Parameter | Description |
|---|---|
cmd |
Optional command (switches the tank pump): onoffgetping |
level |
Tank level (number). |
temperature |
Optional tank temperature (number). |
http://api.iotbind.com/v1/tank.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=on&level=67&temperature=21
{"MESSAGE":"UPDATED"}http://api.iotbind.com/v1/tank.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
"uid": "UNIQUE_ID", "name": "Roof tank", "type": "Water Level", "cmd": "on",
"level": "67", "level_unit": "%", "temperature": "21", "temperature_unit": "C"
}
The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}
Store a position with up to four extra values, or read the latest position.
GET | POST http://api.iotbind.com/v1/tracking.php
| Parameter | Description |
|---|---|
cmd |
Optional command: getping |
latitude |
Latitude (number). |
longitude |
Longitude (number). |
data1 |
Optional text or number to store. |
data2 |
Optional text or number to store. |
data3 |
Optional text or number to store. |
data4 |
Optional text or number to store. |
http://api.iotbind.com/v1/tracking.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&latitude=24.7136&longitude=46.6753&data1=62
{"MESSAGE":"UPDATED"}http://api.iotbind.com/v1/tracking.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
"uid": "UNIQUE_ID", "name": "Car", "type": "GPS tracking",
"latitude": "24.7136", "longitude": "46.6753", "data1": "62", "data1_unit": "km/h"
}
The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}
iotBind works with the MQTT.one service: the platform publishes to your topics when a device changes, and your devices publish JSON messages to iotBind.
{ "key": "DEVICE_KEY", "uid": "UNIQUE_ID", "cmd": "off", "data1": "24.5" }
MQTT requires a plan with the MQTT feature and an account at MQTT.one
400 | Bad request: the address, parameters or body are not valid. |
401 | Unauthorized: the device key or unique ID is wrong. |
404 | Not found: the requested resource does not exist. |
429 | Too many requests: slow down, or check your plan limits. |
Create a free account in a minute and connect your first device today.