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.

To view 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.

To use the API, you need an authorization token. Make the following request to get a token:
                        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 expiration period of a token is determined by the value of the token_ttl parameter in the Admin area => Settings => Main section.
You can stop the HAProxy service with the following request:
                        curl --location 'https://demo.roxy-wi.org/api/service/haproxy/1/stop' \
                        --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 receive the following response confirming that your request was successful:

                        {
                        "status": "Ok"
                        }

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