RESTServer RESTServer icon

RESTServer allows execution of Chimera commands through a REST (REpresentational State Transfer) interface. See also: listen, list

There are several ways to start RESTServer, a tool in the Utilities category. When RESTServer is started, it prints a message of the form

REST server on host 127.0.0.1 port port_number
If RESTServer is launched by specifying --start on the Chimera command line, the output is sent to stdout; this is particularly useful for programs that want to launch and control Chimera programatically. Requests may then be sent to Chimera via URLs that start with http://localhost:port_number/. Chimera supports two types of requests: predefined content supplied by Chimera and command execution.

Predefined content may be accessed by appending the path in the table below to the URL http://localhost:port_number/static/:
Path Content
cmdline.html An interface for executing commands in Chimera. Typically, this page is accessed from a browser; the user can type in commands and see the replies in the web page.

To execute commands, requests should be sent to the URL http://localhost:port_number/run with the Chimera commands encoded in one or more command parameters. Chimera can process either the GET or POST method in the HTTP request. Messages resulting from the sequential execution of these commands will be sent as text/plain reply to the request instead of the Reply Log (although certain messages that require an answer will still raise a dialog).

RESTServer is designed as a replacement for ReadStdin. ReadStdin is frequently used in conjunction with the listen command. With both ReadStdin and listen generating output to stdout, a program parsing Chimera responses needs to demultiplex the output into separate sources. RESTServer uses its network connections strictly for command execution and returning command output. The listen command has been augmented to take a rest option to send notification messages to a REST server instead of the standard channels. By using separate communication channels for notification and command execution, a program that controls Chimera remotely need not handle possibly mixed output from different sources.


UCSF Computer Graphics Laboratory / April 2013