HTTP API
Sending Device to Cloud messages using HTTP API. All requests require a x-subscription-key
header, please reach out support to obtain one.
Method
Method | URI | Name | Summary |
---|---|---|---|
POST | https://hub.m2c.io/v1/networks/iotinabox/uplink | Device Uplink | Sends telemetry data |
Header values
Header | Value |
---|---|
Content-Type | application/json |
x-subscription-key | API Key |
Custom JSON Payload
{
"eui": "UNIQUE_DEVICE_ID",
"format": "json",
"data": {
"temp": 20
}
}
Example CURL request
curl --request POST \
--url https://hub.m2c.io/v1/networks/iotinabox/uplink \
--header 'Content-Type: application/json' \
--header 'x-subscription-key: API-KEY' \
--data '{
"eui": "UNIQUE_DEVICE_ID",
"format": "json",
"data": {
"temp": 20
}
}'
Request Example Using Cayenne LPP
{
"eui": "UNIQUE_DEVICE_ID",
"format": "hex",
"data": "0367014a046882"
}
Request Example Using MQTT API Payload
{
"eui": "UNIQUE_DEVICE_ID",
"format": "json",
"data": [
{
"channel": 1,
"value": 16.4,
"type": "temp",
"unit": "c"
},
{
"channel": 2,
"value": 75,
"type": "rel_hum",
"unit": "p"
},
{
"channel": 5,
"value": 75,
"type": "batt",
"unit": "v"
},
{
"channel": 10,
"value": 1,
"type": "digital_sensor",
"unit": "d"
},
{...}
]
}
The data property must be a JSON array of objects, each element having channel
, value
, type
and unit
porperties. Refer to the list of our
supported data types) for the type
and unit
properties.
Image Upload API (Preview)
The following endpoint consumes image stream and sensor data to be processed on myDevices platform.
Method
Method | URI | Name | Summary |
---|---|---|---|
POST | https://hub.m2c.io/v1/networks/iotinabox/data | Image Uplink | Sends image and telemetry data |
Headers
Header | Value |
---|---|
Content-Type | multipart/form-data |
x-subscription-key | API Key |
One of the part of the body should be set to image
with the filename and additional parts can be sent with sensor data. The key would be the channel number ch_x
and value would follow our MQTT channel based payload: type,unit=value
. Supported list of data types
Body
Key | Value |
---|---|
eui | fc0f860000000001f3 - Device ID |
snapshot | route65.jpg |
ch_1024 | file,image |
ch_x | type,unit=value |
... | ... |
Example Curl Command
curl --request POST \
--url https://hub.m2c.io/v1/networks/iotinabox/data \
--header 'x-subscription-key: API-KEY' \
--header 'content-type: multipart/form-data' \
--form snapshot=@file.jpeg \
--form 'ch_1024=file,image=snapshot' \
--form 'ch_171=temp,f=75' \
--form 'ch_6=temp,f=75' \
--form 'ch_4=rel_hum,p=80' \
--form 'eui=fc0f860000000001f3'