서비스 소개
#Auth API
[POST] /api/login
Make login with ID and password. Returns JWT.
Parameters
| Name | Type | In | Description |
|---|
id | string | body | Required. Login ID for control hub. |
pw | string | body | Required. Login password for control hub. |
Response
- Success:
- Code:
201 - Content:
<JWT|string>
- Error:
| Code | Content |
|---|
| 401 | authentication failed |
[POST] /api/autologin
Make login JWT. Returns id
Parameters
| Name | Type | In | Description |
|---|
jwt | string | header | Required. Previously signed JWT for control hub. |
Response
- Success:
- Code:
201 - Content:
{
id: [string],
exp: [integer],
iat: [integer]
}
- Error:
| Code | Content |
|---|
| 401 | authentication failed |
#Device API
[GET] /device/all
Get registered devices list
Parameters
| Name | Type | In | Description |
|---|
jwt | string | header | Required. Previously signed JWT for control hub. |
Response
- Success:
- Code:
200 - Content:
[
{
id: <device id|string>,
status: <device status|json>,
online: <divice online status|bool>
}
...
]
- Error:
| Code | Content |
|---|
| 401 | authentication failed |
[GET] /device/:deviceId
Get device status.
Parameters: None
Response
- Success:
- Code:
200 - Content:
{
id: <device id|string>,
status: <device status|json>,
online: <divice online status|bool>
}
- Error:
| Code | Content |
|---|
| 400 | Invalid request parameters |
| 404 | device <deviceId> not found |
Response’s < device status > contents
| Device Type | Content |
|---|
| passiveSwitch | { power: [bool] } |
| passiveTactSwitch | { } |
| ledDisplay | not supported |
[POST] /device/:deviceId
Write device status.
Parameters:
- Common
All requests requires jwt token.
| Name | Type | In | Description |
|---|
jwt | string | header | Required. Previously signed JWT for control hub. |
| Name | Type | In | Description |
|---|
toggle | bool | body | If true, toggles device’s power status. |
power | bool | body | Set device’s power status. |
| Name | Type | In | Description |
|---|
push | bool | body | If true, pushes switch of device |
Response
- Success:
- Code:
201 - Content:
{ status: <device status|json> }
- Error:
| Code | Content |
|---|
| 400 | Invalid request parameters |
| 401 | device <deviceId> not found |
| 404 | device <deviceId> not found |
| 503 | device <deviceId> is offline |