C++ Tango REST API implementation Joint Institute for Nuclear Research, Dubna, Russia RestDS – C++ Tango REST API implementation Georgy Sedykh, Evgeny Gorbachev TANGO Workshop @ ICALEPCS 2017
Web clients 1. Web technologies progress 2. Advantages: Universal Flixible Well-looking Convenient Universal tools for communication between Tango Controls and Web clients are required
REST Global identification of resources (URL); REST (Representational State Transfer) – architectural principles to design web services that focus on system’s resources. Global identification of resources (URL); Manipulation of resources through the standard protocol (HTTP); Stateless;
Tango REST API RC4 * Describes how to: Operate with different tango hosts; Browse Tango units (devices, attributes, properties, commands, pipes); Write/Read attributes; Execute commands; Write/Read pipes; Get/Set properties; Use authentication mechanisms; Transmit arguments as http parameters; Parse Response JSON; Use Error codes; http://tangodevel.jinr.ru:8080/tango/rest/rc3/nuclotango.jinr.ru/20000/devices/sys/tg_test/1/attributes/DevDouble/value Attribute Command Pipe Property REST Service URL REST API Version Tango host Tango device ID * http://tango-rest-api.readthedocs.io/en/latest/
RestDS – Tango module, designed to provide access to tango control system units through http requests; Features: Developed in C++ with Boost and OpenSSL; Windows and Linux supported; Lightweight; Tango device server; Both http and https protocols supported; Basic http authentication supported; Uses server-side role-based Tango access control and logging system (More info: TUPHA171 – Development of NICA Control System: Access Control and Logging); Git: http://tangodevel.jinr.ru/git/tango/web/RestDS.git; Tango REST API RC4 partial support (so far without pipes);
RestDS :: Examples To read attribute: GET http(s)://host:port/tango/rest/rc4/devices/domain/family/member/attributes/name/value To write attribute: POST / PUT http(s)://host:port/tango/rest/rc4/devices/domain/family/member/attributes/name + arguments as POST parameters. To execute command without arguments: POST / PUT http(s)://host:port/tango/rest/rc4/devices/domain/family/member/commands/name To execute command with arguments: POST / PUT http(s)://host:port/tango/rest/rc4/devices/domain/family/member/commands/name + arguments as POST parameters.
Response as JSON object if success Or http error code if failed.. RestDS :: Operation diagram http://host:port/tango/rest/rc4/devices/thermo/shoulder/1/attributes/T56/value Web Client RestDS HTTP code 200 - OK Response as JSON object if success Host:port Threads number Authentication Security (SSL) { “name”: “T56”, “quality”: “VALID”, “timestamp”: 1473348563, “value”: 273.12, } Or http error code if failed.. 400 – Bad request 403 – Forbidden 401 – Unauthorized 404 – Not found
Web client examples :: Thermometry
Web client examples :: Satellite refrigerators control
Summary: Web client applications are cross-platform, well-looking and convenient; Web clients will be widely distributed within the NICA Control system. RestDS Tango module was developed to provide universal way to communicate between web client and Tango-based control system.