Versions Compared

Key

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

...

URIHTTP Method
https://m.thingscale.io/v2/device/<DEVICE_ID>GET

Parameters

 


Expand
titleRequest parameters


Request ParameterDescription:
Header:X-APITOKEN:API_TOKEN_HERE
Body:N/A


...

Expand
titleResponse Body

Device's metadata returned in JSON.

 
ElementsTypeDescriptionMax Length
device_idstringDEVICE_ID2147483647
descriptionstringdescription of device64bytes
enabledboolean

false : device disabled

true : device enabled


mapped_chintdevice related channel_id2147483647
device_typestringtype of device32bytes
locationstringlocation of device32bytes
manufacturerstringmanufacturer of device16bytes
activate_atstringactivate time of device(ISO8601) 


Code Block
titlesample payload
[
    {
        "device_id": "1085266243",
        "description": "sht-25",
        "enabled": true,
        "mapped_ch": 0,
        "device_type": "Xbee Pro",
        "location": "Niigata,Japan",
        "manufacturer": "sensincs,llc",
        "activate_at": "2015-01-13 16:58:00"
    }
]


...

Expand
titleResponse Code


HTTP Status code:Description/Response Body:
200 OKTransaction OK.
401 UnauthorizedAPITOKEN is invalid or null
{"error" : "APITOKEN is invalid or nullAUTH_REQUIRED"}
404 Not FoundNO_DEVICE

no device found.

{"error" : "no device foundNO_DEVICE"}



Code Block
titlecurl example
 curl -X GET -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/device/DEVICE_ID_HERE

...


Create device

...

Endpoint

URIHTTP Method
https://m.thingscale.io/v2/device/<DEVICE_ID>POST

...

Expand
titleResponse Code


HTTP Status code:Description/Response Body:
201 CreateDevice Created.
401 UnauthorizedAPITOKEN is invalid or null
{"error" : "APITOKEN is invalid or nullAUTH_REQUIRED"}
403 ForbiddenDEVICE_INUSE

Because the same channel as the specified ID exists, it could not be created.

{"error" : "device inuseDEVICE_INUSE"}
403 ForbiddenMAX_DEVICE_REACH

Per account device limit reached.

{"error" : "max device count reachedMAX_DEVICE_REACH"}
405 Method Not AllowedREQUIRE_NEWCH_NUM

New device_id must be required.


...

Code Block
titlecurl example
curl -X POST -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/device/DEVICE_ID_HERE

...


Update device

...

Endpoint

URIHTTP Method
https://m.thingscale.io/v2/device/<DEVICE_ID>PUT

...

Expand
titleResponse Code


HTTP Status code:Description/Response Body:
200 OKTransaction OK.
401 UnauthorizedAPITOKEN is invalid or null
{"error" : "APITOKEN is invalid or nullAUTH_REQUIRED"}
400 Bad RequestBad Request.check JSON array
{"error" : "Bad Request.check JSON arrayBAD_JSON_FORMAT"}
403 ForbiddenNO_DEVICE

changing mapped_ch failed.(Because channel_id is nothing or already exist)

{"error" : "no channel foundNO_CHANNEL"}
404 Not FoundNO_DEVICE

Specified device_id is not found.

{"error" : "no device foundNO_DEVICE"}
500 Internal Server ErrorOTHER_ERROR

Some internal error occured. please contact slalenics admin.

{"error" : "internal error occured"}


...

Expand
titleResponse Code


HTTP Status code:Description/Response:
200 OKTransaction OK.
401 UnauthorizedAPITOKEN is invalid or null
{"error" : "APITOKEN is invalid or nullAUTH_REQUIRED"}
403 ForbiddenDEVICE_ENABLE

Specified device status is enable.(Set status enable if you delete device)

{"error" : "device is enabledDEVICE_ENABLE"}
404 Not FoundNO_DEVICE

Specified device_id is not found.

{"error" : "no device foundNO_DEVICE"}
500 Internal Server ErrorOTHER_ERROR

Some internal error occured. please contact slalenics admin.

{"error" : "internal error occured"}


...