7. Lightware REST API Reference
UCX series – User's Manual
73
Applied firmware package: v1.2.0b9 | LDC software: v2.5.10b1
7.3.3.
Legend for the Control Commands
Command and Response – Example
ɯ
header: GET·
<ip>
/api/V1/MEDIA/VIDEO/
<in>
/SignalPresent·HTTP/1.1
ɮ
body:
<status code>
Format
Description
<ip>
IP address or hostname of the target device
<in>
Input port number
<out>
Output port number
<port>
Input or output port number
<loc>
Location number
<parameter>
Variable defined and described in the command
<expression>
Batched parameters: the underline means that more
expressions or parameters can be placed by using a
semicolon, e.g.
I2;I4;I5
or
F27:E1;F47:E2
ɯ
Sent request
ɮ
Received response
·
Space character
Further not listed
<parameters>
are defined at each commands.
7.3.4.
Lightware REST API vs. LW3 Protocol
All the methods and properties of the LW3 tree structure appears below /api as a HTTP(s) URL. The separator
character is always
slash (‘/’) character instead of point ('.') and colon (':'). The URL is case-insensitive.
Example
The LW3 property:
/V1/MEDIA/VIDEO/I2.ActiveResolution
Available in REST API:
192.168.0.1/api/V1/MEDIA/VIDEO/I1/ActiveResolution
192.168.0.1/API/v1/media/video/i1/activeresolution
The following features implemented only in REST API, but not in LW3 protocol:
▪
The most important commands are listed in this chapter. Other commands can be inferred by the LW3
tree structure, where the read-only (eg.
pr
/V1/MEDIA/VIDEO/I5.Connected) and read-write properties
(
pw
/V1/MEDIA/VIDEO/I5.Name) can be listed. For more details about LW3 tree structure see
section or
7.3.5.
Method Types
GET method
GET method can be used to get the value of a property. It works the same way as LW3 GET command.
PUT/ POST method
In this case, POST and PUT are equivalent, they are for modifying read-write properties and invoke methods.
They replace LW3 SET and CALL command.
7.3.6.
Supported Commands
Query property value (GET)
The requested value is in the body of the response.
Protocol
Command
REST API
ɯ
header:
GET·
<ip>
/api/
<NODEPATH>
/
<PropertyName>
·
HTTP/1.1
Example
ɯ
header:
GET http://192.168.0.1/api/V1/MEDIA/VIDEO/XP/I2/SignalPresent HTTP/1.1
LW3
ç
GET·/
<NODEPATH>
.
<PropertyName>
Example
ç
GET /V1/MEDIA/VIDEO/XP/I2.SignalPresent
Set property value (SET)
The desired property value should be given as a plain text in the body of the request. The new value is in the
body of the response.
Protocol
Command
REST API
ɯ
header:
POST·
<ip>
/api/
<NODEPATH>
/
<PropertyName>
·
HTTP/1.1
ɯ
body:
<new_value>
Example
ɯ
header:
POST http://192.168.0.1/api/V1/MEDIA/VIDEO/XP/I2/Mute HTTP/1.1
ɯ
body:
false
LW3
ç
SET·/
<NODEPATH>
.
<PropertyName>
=
<new_value>
Example
ç
SET /V1/MEDIA/VIDEO/XP/I2.Mute=false
Invoke method (CALL)
The argument should be given in the body of the request.
Protocol
Command
REST API
ɯ
header:
POST·
<ip>
/api/
<NODEPATH>
/
<methodName>
·
HTTP/1.1
ɯ
body:
<new_value>
Example
ɯ
header:
POST http://192.168.0.1/api/V1/MEDIA/VIDEO/XP/switch HTTP/1.1
ɯ
body:
I5:O1
LW3
ç
CALL·/
<NODEPATH>
:
<methodName>
(
<value>
)
Example
ç
CALL /V1/MEDIA/VIDEO/XP:switch(I5:O1)