HTTP Server

The controller runs the HTTPS server on 17000 port.

Requests

/v1/request

Provides a way for making any WebSocket call via HTTPS request.

Type: POST

Headers

Key Value Description
Authorization Basic + base64 hash of a user id and an access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization. This header is more priority as user and token pair.
login Id of a user UUID of a user( the same as user in a hub.offline.login.ui request )
token Access token Access token from the cloud (the same as token in a hub.offline.login.ui request)

Content: application/json

Data: Any WebSocket call as it requested via local WebSocket server.

Errors

HTTP Status Code Case Description
400 If a request doesn't have data or it's not valid JSON format
401 If user or token header missed or it has incorrect values
408 If a request runs more then 1 minute
429 If a controller has more then 100 "opened" requests now
500 Any WebSocket formatted error on request

/v1/method/

Makes a single request but encode all request in an URL. This request supports only simple parameter types and doesn't support nesting in the parameters. If you need to make more complex queries then use /v1/request.

Parameters conversions rules

parameter=value

{
    "params": {
        "<parameter>":"<value>"
    }
}

parameter_bool=booleanValue

{
    "params": {
        "<parameter>":<booleanValue>
    }
}

parameter_int=integerValue

{
    "params": {
        "<parameter>":<integerValue>
    }
}

parameter_float=floatValue

{
    "params": {
        "<parameter>":<floatValue>
    }
}

Type: GET

Headers:

Key Value Description
Authorization Basic + base64 id of user id and access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization. This header is more priority as user and token pair.
login Id of a user UUID of a user( the same as user in a hub.offline.login.ui request )
token Access token Access token from cloud( the same as token in a hub.offline.login.ui request )

Data: No

Examples

https://<ip>:17000/v1/method/hub/info/get
https://<ip>:17000/v1/method/hub/item/value/set?_id=09234njnj234&value=cooling
https://<ip>:17000/v1/method/hub/item/value/set?_id=09234njnj234&value_bool=false
https://<ip>:17000/v1/method/hub/item/value/set?_id=1234567890&value_int=22
https://<ip>:17000/v1/method/hub/item/value/set?_id=1234567890&value_float=123.456

Errors

HTTP Status Code Case Description
400 If a request doesn't have data or it's not valid JSON format
401 If user or token header missed or it has incorrect values
408 If a request runs more then 1 minute
429 If a controller has more then 100 "opened" requests now
500 Any WebSocket formatted error on request

/v1/broadcasts

Initializes a "keep-alive" connection to deliver WebSocket broadcasts to a client. Supports only one-way requests.

Type: GET

Headers

Key Value Description
Authorization Basic + base64 id of user id and access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization. This header is more priority as user and token pair.
login Id of a user UUID of a user( the same as user in a hub.offline.login.ui request )
token Access token Access token from cloud( the same as token in a hub.offline.login.ui request )

Data: No

Errors

HTTP Status Code Case Description
401 If user or token header missed or it has incorrect values
429 If a controller has more then 100 "opened" requests now

/v1/addons/cameras/stream/snapshot/{streamId}

Get snapshot of video stream in 256x256 resolution.

Type: GET

Headers

Key Value Description
Authorization Basic + base64 id of user id and access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization. This header is more priority as user and token pair.

Data: RAW jpeg data

Errors

HTTP Status Code Case Description
401 If user or token header missed or it has incorrect values
404 If a stream doesn't exist
429 If a controller has more then 100 "opened" requests now

/v1/addons/cameras/stream/audio/{streamId}

Send ACC audio to the device (same format as sending directly to camera). streamId - it's usually an id of audio_stream item. This request is configured by plugin via cameras.create_audio_stream() Lua call.

Type: PUT

Headers

Key Value Description
Authorization Basic + base64 id of user id and access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization. This header is more priority as user and token pair.

Data: ACC audio data

Errors

HTTP Status Code Case Description
400 If a request doesn't have data
401 If user or token header missed or it has incorrect values
404 If a stream doesn't exist
408 If a request runs more then 30 minutes
429 If a controller has more then 100 "opened" requests now

/v1/links/plugins/{pluginName}/{linkId}

Provides a way to pass HTTP(s) requests data to and from Lua scripts. Executes registered plugin script. Can use both HTTPS and HTTP connections on this endpoint. See also http_server Lua module documentation.

Type: GET, POST

Headers

Key Value Description
Authorization Only for https links. Basic + base64 hash of a user id and an access token A user id and access token in the basic scheme according to standard of Basic HTTP authorization.

Content: any MIME-type

Data: Any data passed via HTTP requests (URI parameters, headers, POST request's body).

Errors

HTTP Status Code Case Description
100 Continue. Handles Expect: 100-continue header of POST requests
400 If a request doesn't have data plugin name or link Id
401 If user or token header missed in HTTPS request or it has incorrect values
404 A plugin is not found; a link is not found; a link belongs to another plugin; a link is deleted
405 Method not allowed. Only GET and POST requests allowed
408 If a request runs more then 30 minutes
429 If a controller has more then 100 "opened" requests now
499 Client closed request
500 Any other error