An API, or application programming interface, is a set of rules that defines how applications or devices connect and communicate with each other. A REST API adheres to the design principles of the REST (representational state transfer) architectural style. For this reason, REST APIs are often referred to as RESTful APIs.

A REST API enables developers to interact with Roxy-WI by starting, stopping, and restarting services, as well as adding, editing, and deleting ACLs. It communicates using JSON requests and responses. Request headers and parameters are crucial in REST API calls, as they contain important identifier information such as metadata, authorizations, uniform resource identifiers (URIs), caching, cookies, and more. Both request and response headers, along with standard HTTP status codes, are utilized in well-designed REST APIs.

icon
You should always include an access token in the request headers. Instructions for generating the token are provided below.

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

The command output will look something like this:

To use the API, you need an authorization token. Make the following request to get a token:

You will get a new token:

icon
The expiration period of a token is determined by the value of the token_ttl parameter in the Admin area => Settings => Main section.

To stop the HAProxy service, make the following request:

You should get the following response:

icon
To start or restart the service, just replace the word stop in the URI above with another necessary action (start or restart).

To add an ACL to a section, make the following request:

The if parameter can take the following values:

The then parameter can take the following values:

The action parameter can take the following values:

To delete an ACL from a section, make the following request:

icon
All parameter values, except for the action parameter, must match those in the POST request body for this ACL. The action parameter value may differ.

The if parameter can take the following values:

The then parameter can take the following values:

The action parameter can take the following values: