An API, or application programming interface, is a set of rules that define how applications or devices can connect to and communicate with each other. A REST API is an API that conforms to the design principles of the REST, or representational state transfer architectural style. For this reason, REST APIs are sometimes referred to RESTful APIs.

A REST API allows developers to work with Roxy-WI: to start, stop and restart the services, to add, to edit and to delete ACLs, etc. It communicates via JSON requests and JSON responses. Request headers and parameters are also important in REST API calls because they include important identifier information such as metadata, authorizations, uniform resource identifiers (URIs), caching, cookies and more. Request headers and response headers, along with conventional HTTP status codes, are used within well-designed REST APIs.

icon
Note that you should always add an access token to request headers. The instructions on generating the token can be found below.

To get the list of all available endpoints, perform the following command:

The command output will be similar to:

You need an authorization token to use the API. Make the following request to get a token:

You will get a new token:

icon
The validity period of a token is defined by the token_ttl parameter value in the Admin area-Settings section, the Main tab.

Make the following request to stop the HAProxy service:

You should get the following response:

icon
You may replace the word stop in the URI above with another necessary action (start or restart) to start or restart the service.

Make the following request to add an ACL to a section:

The if parameter may take the following values:

The then parameter may take the following values:

The action parameter may take the following values:

Make the following request to delete an ACL from a section:

icon
Not that all parameter values except the action parameter value must be the same as in the POST request body for this ACL. The action parameter value may differ.

The if parameter may take the following values:

The then parameter may take the following values:

The action parameter may take the following values: