Joint Institute for Nuclear Research Dubna Russia Rest
Joint Institute for Nuclear Research, Dubna, Russia Rest. DS – 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 2
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; 3
Tango REST API RC 4 * 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/rc 3/nuclotango. jinr. ru/20000/devices/sys/tg_test/1/attributes/Dev. Double/value REST Service URL REST API Version Tango host Tango device ID * http: //tango-rest-api. readthedocs. io/en/latest/ • • Attribute Command Pipe Property 4
Rest. DS – Tango module, designed to provide access to tango control system units through http requests; Features: • Developed in C++ with Boost and Open. SSL; • 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: TUPHA 171 – Development of NICA Control System: Access Control and Logging ); • Git: http: //tangodevel. jinr. ru/git/tango/web/Rest. DS. git; • Tango REST API RC 4 partial support (so far without pipes); 5
Rest. DS : : Examples To read attribute: GET http(s): //host: port/tango/rest/rc 4/devices/domain/family/member/attributes/name/value To write attribute: POST / PUT http(s): //host: port/tango/rest/rc 4/devices/domain/family/member/attributes/name + arguments as POST parameters. To execute command without arguments: POST / PUT http(s): //host: port/tango/rest/rc 4/devices/domain/family/member/commands/name To execute command with arguments: POST / PUT http(s): //host: port/tango/rest/rc 4/devices/domain/family/member/commands/name + arguments as POST parameters. 6
Rest. DS : : Operation diagram http: //host: port/tango/rest/rc 4/devices/thermo/shoulder/1/attributes/T 56/value Web Client Rest. DS HTTP code 200 - OK • Host: port Response as JSON object if success • Threads number { “name”: “T 56”, “quality”: “VALID”, “timestamp”: 1473348563, “value”: 273. 12, • Authentication • Security (SSL) } Or http error code if failed. . 400 – Bad request 401 – Unauthorized 403 – Forbidden 404 – Not found 7
Web client examples : : Thermometry 8
Web client examples : : Satellite refrigerators control 9
Summary: • Web client applications are cross-platform, well-looking and convenient; • Web clients will be widely distributed within the NICA Control system. • Rest. DS Tango module was developed to provide universal way to communicate between web client and Tango-based control system. 10
- Slides: 10