Clients can communicate with Paint using a REST protocol. The protocol allows to trigger user actions or query Paint runtime values.
Configuration
Allows to specify port used for REST commands.
<RemoteControl> <Enabled value="1"/> <Port value="8000"/> <Protocol value="REST"/> </RemoteControl>
REST action invocation
To trigger a user action, send a http POST request to an url in form:
http://<paint.host.name>:<REST.port>/action
Request body must contain xml with action data formatted the same way as Action-based protocol.
Example:
POST http://localhost:8000/action req data <Clear/>
REST value queries
To query runtime value, send a http GET request to an url in form:
http://<paint.host.name>:<REST.port>/query/<valueName>[?param1[¶m2]]
The query can contain additional parameters in form: <param.name>=<param.value>
Example:
GET http://localhost:8000/query/Clips?from=123&to=345
Paint sends a reply containing a xml data formatted as:
<QueryResult query=”<valueName>”>valueData</QueryResult>
Value data can be either a string representation of primitive value or a xml structure in case of non-trivial values.
In case the query can not be resolved, a 404 error is returned.
Values supported by REST query
Value Name |
Value Description |
Reply Description |
| PreviewCamera | Camera ID currently selected in preview. |
32bit integer |
PreviewTimecode |
Timecode of frame currently shown in preview. |
64bit signed integer |
VideoFormat |
Current video format:
|
<QueryResult query="VideoFormat"> <id value="HD1080P_50"/> <aspect value="16:9"/> <width value="1920"/> <height value="1080"/> <interlace value="false"/> <fps value="50"/> </QueryResult>
|
Clips |
Retrieve a currently stored clips:
|
<QueryResult query="Clips"> <Clips> <Clip name="clip0_0|CLIP10" from="3536828" to="3537885" cameraId="120"/> <Clip .../> ... </Clips></QueryResult>
|