Chapter 2
Common principles
The REST API has been developed with awareness of following key principles: performance, simplicity, browseability and security. Those principles form the final structure and mechanism of the API.
The performance principle is assured by a highly integrated and embedded Web server without any auxiliary framework between the server and the core of the REX Control System. Although integrated directly into the core, the Web server is separated from the core by a thin interface so that possibility of interference with the real-time execution core is minimized and eventual separation of Web server into a stand-alone application is possible. The Web server runs in a dedicated thread with adjustable priority utilizing asynchronous socket communication.
From the structure point of view, the performance is achieved by distinguishing between data and meta-data, so that re-sending of unnecessary or already transmitted data is minimized. A short and a long format of response is distinguished, so in cases where the short format is sufficient, the amount of data transmitted may be reduced. A user should use the JSON data format in requests to gain maximal performance. The JSON data format is currently the only format supported within write (POST) requests, although the data may be retrieved from the Web server in HTML, XML and plain text format.
The simplicity and browseability principles are reflected in the structure of the API. The structure is described in chapter 4. The API reflects as much as possible an already defined structure and links of a real-time control algorithm. Almost all rules and convections that the user already knows from using the REX Control System, RexDraw or RexView may be applied. The browseability makes it easy for any user to start using the REST API of the REX Control System without the need for detailed study of user manual and without the need for specialized tools. Anyone with basic knowledge of HTTP protocol and modern Web browser can start using REST API of the REX Control System. Every single resource provided by the interface can be found, listed and inspected using a standard modern Web browser.
The Web server has been also designed with a respect to the safety and security. Although the Web server is an integral part of the control system, the thin interface between the core and Web server minimizes the possibility of interference. All data is checked for consistency, all memory is zeroed and memory allocations are minimized. The security is ensured by utilizing standard HTTPS protocol (HTTP over SSL) and by providing (yet limited) basic user authentication.
[Previous] [Back to top] [Up] [Next]