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#

MethodURINameSummary
POSThttps://hub.m2c.io/v1/networks/iotinabox/uplinkDevice UplinkSends telemetry data

Header values#

HeaderValue
Content-Typeapplication/json
x-subscription-keyAPI Key

Custom JSON Payload

{
"eui": "UNIQUE_DEVICE_ID",
"format": "json",
"data": {
"temp": 20
}
}

Request Example Using Cayenne LPP

{
"eui": "UNIQUE_DEVICE_ID",
"format": "hex",
"data": "0367014a046882"
}

For Cayenne LPP Documentation

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#

MethodURINameSummary
POSThttps://hub.m2c.io/v1/networks/iotinabox/dataImage UplinkSends image and telemetry data

Headers

HeaderValue
Content-Typemultipart/form-data
x-subscription-keyAPI 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

KeyValue
euifc0f860000000001f3 - Device ID
snapshotroute65.jpg
ch_1024file,image
ch_xtype,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'