Using HTTP

By using a HTTP/HTTPS Transport in this chapter, we describe the send stream from device to the platform.

If you send stream by REST,refer Stream service



Send stream from device

HTTP/HTTPS Endpoint

URI

HTTP Method

API version

URI

HTTP Method

API version

  • http://m.thingscale.io/post_v1/

  • (Secure)https://m.thingscale.io/post_v1/

POST

1.x

  • http://m.thingscale.io/post_v2/

  • (Secure)https://m.thingscale.io/post_v2/

POST

2.x



Parameters



Request parameter

Description

Request parameter

Description

Header:

Content-Type:application/x-www-form-urlencoded
X-DEVICETOKEN:DEVICE_TOKEN_HERE
X-DEVICEID:DEVICE_SERIAL_HERE

X-TAGNAME:TAG_NAME // 2.x only

Body:

Request body is form-urlencoded payload as follows:

(API v1.x)sample payload

v=VALUE&v2=VALUE2&v3=VALUE3&v4=VALUE4

(API v2.x)sample payload

{"temp" : 25, "humid" : 50}

 

HTTP Status code:

Description/Response Body:

HTTP Status code:

Description/Response Body:

200 OK

Transaction OK.

401 Unauthorized

DEVICE_TOKEN is invalid or NULL.

201 Created

NEW_DEVICE_FOUND

Created new device.You must map device to channel.

400 Bad Requeset

DEVICE_ID_ZERO

deivce_id:0 is not allowed.(or device_id:NULL)

403 Forbidden

NO_MAPPED_CH

Sender device's serial number is not map to channel.

403 Forbidden

DEVICE_DISABLED

Devices status is disabled.

 

About RateLimiting

If you want to use the device connector in HTTP / HTTPS, rate limit (flow control) mechanism will be applied.

Currently, it is limited to a single data transmission per second.

HTTPS / HTTPS device connectors are available for devices that can not use the MQTT.
We strongly recommend the use of MQTT device connector.



(API v2.x)curl example
curl -X POST -v -H "X-DEVICETOKEN: DEVICE_TOKEN_HERE" -H "X-DEVICEID: DEVICE_ID_HERE" -H "Content-Type: application/json" -d '{"temp":25}' -k https://m.thingscale.io/post_v2/





© 2014-2022 SENSINICS,LLC