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 as RESTful APIs.

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

For the list of all available endpoints, scroll down your Roxy-WI page and click Swagger in the lower right corner. You will be redirected to the Swagger page.

In order to use the API, you will need to obtain an authorization token. You can obtain it with the following request:
                        curl --location 'https://demo.roxy-wi.org/api/login' \
                        --header 'Content-Type: application/json' \
                        --data '{
                            "login":"admin",
                            "password":"admin"
                        }'
                    

You will get a new token:

                        {
                        "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcyNDY5NTM5NS
                            wianRpIjoiNTQ2ZmQ0ZGQtZTY2Yi00NWZhLWJhOWItNDI4MGQ2N2QwNzU2IiwidHlwZSI6ImFjY2VzcyIsInVzZXJfaWQiOiI1
                            IiwibmJmIjoxNzI0Njk1Mzk1LCJjc3JmIjoiZWNlMmFkZDMtM2M3MS00OTVkLWIxOTYtMmFlNjRlMzg4OTQ1IiwiZXhwIjoxNz
                            I0NzgxNzk1LCJncm91cCI6IjEifQ.UVzio3pqLhOPNockk7A6fycWgWDrD_MHiIhbnag8Du-6kFCVXMBx67MkrOUpf47DprmMMe
                            1Kho_dU5zEqgfFu-pSsjazSwMn__bhxrRoY9elNNrCyjhHuVMebNpfH32QZJlPylLtg5IHdehOyPYPicKFAIP_VUukocFdeEVqe
                            2y0eKgHlznNHdiy_1bcFNDtq_BtbqOKQx8r_5Nz_gZngzGu6WODK9qpahHRQNK2emVqmqI5UbJ8Xt9nBVmj0bJ-KToWUedNO-jj
                            W4jLN0vr-EI3VNf51zz9tRqYjgt7mYkM1TFviv4aYZQ8KMqQC5mVmDizL_N9uid8SbgpVHle5I3GT0fmVDrfr817ZkoJXn3OPBH
                            voY3bW8gJNEVudKdTSYD3ohQ_qKe9HZZsUWrKJ0v0uJywCbuf-83TRnvjSbz3zCdnUbfO_OQFCbkJZswQeAbeYPJRNimiHvcjnf
                            PuYlTymCPoykpglLHcN2S_TRjBW87WmCG4X9I6tR2CmnzGU2FmyKZU9T7hB8alpk96tZ7eM68vsqEf3nquK6RGvxOaO2UmH4QXb
                            UcyoOT36SEHeWuUlIx9r3lqYXkvzArHbTQ6Sek7yMfA1-Ms3bamXqXgsJsuO6WqAMEmQg_j5LG7EdPvrkLcTKojX_dWvhqfJsV8mpfafe5qjf7TMte8OaY"
                        }
                    
icon
The token expiration period is defined by the value of the token_ttl parameter in the Main tab of the Admin area => Settings section.
You can stop the HAProxy service with the following request:
                        curl --location 'https://demo.roxy-wi.org/api/service/haproxy/1/reload' \
                        --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdC
                            I6MTcyNDgyODIxNywianRpIjoiZDgwMTAxYmEtMTUwMi00ZGZkLWIwYzUtMmZmNGQ0MWU1YzQwIiwidHlwZSI6ImFjY2VzcyI
                            sInVzZXJfaWQiOiI1IiwibmJmIjoxNzI0ODI4MjE3LCJjc3JmIjoiMTBlNmQ0YjEtZmZkNC00Y2I4LWFlZWEtYWY5YTQxYmY5
                            OWZiIiwiZXhwIjoxNzI0OTE0NjE3LCJncm91cCI6IjEifQ.hNlPmQidFIZAJFhLJBFPRWTsYO1wA5-xQQFFPhvt0cqQipTQbQ
                            Ee8-9RxtfFs66P6B9s-ZvFgGeOvY2zvtKceptAM8ym03HmVA-9KQ6sm51im8obVIjy39-q9-K4MlIseaQz1qGPSC_A3rRNfOr
                            RJZ3WGRUtdhK5eOIsw-kwCuyxV_F5lQSQ0fD-N8f6dlU3vtnRE3bK5DzRJ4bVu7-MWjbXg5oJ6WV0RnL92HNedBN0LTMYQKbX
                            LeIlWuuZTj5iWoXTc0Is_H10Gj-uWDXdsFEyNX_Ie8NnkEwnx1C8FjLVZpT5z1jHcuazgUHfFXXPjpjyZ2aLnq1El1-nT1iNRV
                            J511xcJ3Stiil1VIFHHf9nUfaVy7-ty2ectJL2gSoVB22moDiJlGPztZsX1YLCrgFoCCSWz8go-rT2f-8VcTIg88Rm7yb2l4ifF
                            kZnxzWIGLQEeY8opsPqH_JTRUtN7IOonRokCp9mrMWN4cXWkUV9cLVpw6AzH5l0OKGnQMrHtGJZehiW8_AyMYPSYRmEM7hexzLQ
                            fGkrSKZSvBCwfuarXMNj1qXMhvswnCoT6rS48QmE0rb5olt7X06FUlVIZxn2JqCHzb1ZHB_PidNjiorM8krwiQ4Rp3nQOIvR3OD
                            6ZlszWizwtgwC206Usa_zwLl3XRcjjuLAjA2djNQ2TWI'
                    

You should get the following response indicating that your request was successful:

                        {
                        "status": "Ok"
                        }

                    
icon
You can replace reload in the above URI with another required action (start, reload, or restart) to start or restart the service.