Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

...

Expand
titleRequest parameters


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

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

(API v2.x)sample payload

Code Block
languagejs
{"temp" : 25, "humid" : 50}
Expand
titleResponse Code

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.

Note

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
Code Block
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/

...