Application Programming Interface (API)
Endurance has been built from the ground up with an API-first approach to meet modern infrastructure challenges. Every appliance function is accessible through a modern RESTful API, enabling headless operation, full automation and seamless integration with existing toolchains, with real-time updates available via WebSocket connections.
The appliance can be configured either using the WebUI or by sending API requests directly. In fact, when the WebUI is used, it calls the same API in the background to configure the appliance. This means that anything that can be done in the WebUI can also be achieved through the API.
API calls can be formed and sent using any RESTful-compliant application or API test client. This enables Endurance to be configured without using the WebUI.
The API Port
The API is served over HTTPS on the same IP address and port as the WebUI. By default, the API listens on port 443. The listening IP address and port are configured on the User Interface page - for details, refer to User interface.
Sending API Requests
All API endpoints share a common base URL that is formed from the appliance’s IP address and API port, followed by the API version:
https://<appliance-IP-address>:<API-port>/api/v1/
For example, the base URL for the appliance used throughout this manual would be https://10.11.40.60:443/api/v1/.
Each request uses the standard HTTP method appropriate to the action being performed:
-
GET - retrieve one or more existing objects.
-
POST - create a new object.
-
PUT - update an existing object, or apply pending configuration changes.
-
DELETE - remove an existing object.
Request and response bodies are formatted as JSON.
|
As with the WebUI, configuration changes made through the API are staged and do not take effect until they are applied. To apply pending changes and restart the affected services, send the following request (where PUT https://<appliance-IP-address>:<API-port>/api/v1/<appliance-id>/services/apply |
Authentication
Endurance uses token-based (bearer token) authentication. Before sending any other request, you must authenticate to obtain an access token.
To authenticate:
-
Send a POST request to the token endpoint, passing the same email address and password used to log into the appliance in the request body:
RequestPOST https://<appliance-IP-address>:<API-port>/api/v1/token
Body{ "email": "<your-email-address>", "password": "<your-password>" } -
The response contains the access token, together with the appliance ID, in its
dataobject:{ "data": { "token": "<access-token>", "appliance_id": "<appliance-id>" } } -
Include the token as a bearer token in the Authorization header of all subsequent requests:
Authorization: Bearer <access-token>
API Reference
Complete reference documentation for the API - covering every available endpoint, along with its request parameters and response fields - is provided in the Endurance API reference.
Configuring Endurance using Bruno
Loadbalancer.org provides a companion guide, Configuring Endurance using Bruno, that demonstrates how to build a complete layer 7 virtual service using API requests only.
Bruno is a free, open-source, offline API client available for Linux, Windows and macOS. It uses a "collection" to define the API environment and store a set of API requests that can then be run in order. A ready-to-run collection for the example environment can be downloaded from here. For full details, refer to the Configuring Endurance using Bruno guide.
|
Every endpoint, its parameters and its responses are listed in the API Reference. |