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
HTTP/HTTPS Endpoint
- Endpoint
- http(s)://m.thingscale.io/post_v2/
- HTTP Method
- POST
Parameters
Request parameters
Header
Content-Type:application/x-www-form-urlencoded
X-DEVICETOKEN:
DEVICE_TOKEN_HEREX-DEVICEID:
DEVICE_SERIAL_HEREX-TAGNAME:
TAG_NAME
Body
- JSON ex)
{"temp":25}
- JSON ex)
Response Code
| HTTP status code: | Desc/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 Request | 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 - rate limit)
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/ |
|---|