REST

You can execute robots as RESTful services. This allows you to invoke a robot from any programming language, or directly from a browser using JavaScript.

On the Repository > Robots tab you can find a column named REST. Clicking this column brings up a window that allows you to test your robot as a service.

Use the Request pane of the service window to construct a request. Click Test Service to execute the robot. The result is then displayed in the Response pane of the window.

The format buttons allow you to configure the formats of the request and responses while testing, but when you call the service from code, the format is controlled by the Accept and Content-Type HTTP headers. The Accept header specifies the desired response format, and the Content-Type header specifies the request format.

Robots that require input must be invoked using POST. Robots without input may be invoked using either GET or POST.

REST services are easily invoked from a robot by using the "Call REST Web Service" action.

If the project or robot name contains any non-ASCII characters, make sure that the URL is encoded properly (UTF-8 URL encoding). This is automatically done in robots, but if the service is called from code, the developer is responsible for encoding the URL.

Note Robots that run as services will stop the first time the robot generates an API exception. This is different from scheduled robots, which will continue to run regardless of any API exception generated by the robot. You should think of REST services as something short-lived, such as a Google search or translating a sentence.

Each robot that is run as a service uses a request thread. When the Management Console is running embedded in a RoboServer, there is a maximum of 100 request threads. These 100 threads are used for all types of HTTP requests, such as users accessing the Management Console, uploads from Design Studio, and the Repository API. If you need to run a higher number of concurrent REST services, you will need to install a standalone version of the Management Console on Tomcat so that you can control the number of request threads.