Public API Overview
Welcome to the Eggplant DAI Public API documentation. This guide will help you get started with the public REST API endpoints, enabling you to interact with Eggplant DAI's services. Through the public REST API, you can programmatically access a variety of resources and functionalities offered by Eggplant DAI, such as obtaining access tokens, listing and retrieving test results, and accessing logs for individual tests.
Generate Your API Client Credentials
To use the public API, you need to authenticate and obtain an access token. This token must be included in the header of all subsequent API requests.
Admin users can create API clients, which have permissions equivalent to an admin user, except for creating additional API clients.
To create an API client:
- Visit the Eggplant DAI UI and log in with your admin credentials.
- Navigate to System > API Access.
- Click New API Access.
- Add a name and description for your credentials.
- Click Create.
- When prompted, click Download and store the credentials
.csv
file in a safe place.
You can now use the client_id
and client_secret
variables from your credentials file to acquire an access token.
Treat these credentials as you would a password. Store them securely and do not share them. If your API credentials are ever misplaced, leaked, or forgotten, they can be revoked or regenerated through the API Access interface.
Acquire an Access Token and Authenticate
Use the credentials from the previous steps to obtain an access token from the API and authenticate.
Example Request
curl -X POST "https://YOUR_DAI_BASE_URL/api/v2/auth" \
-H "Content-Type: application/json" \
-d '{"client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET"}'
Example Response
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJ2U1FaeW9W...",
"expires_in": 600
}
Access Protected API Resource Endpoints
Once authenticated, you can use the valid access token to access protected API resource endpoints. Since the token expires after ten minutes, you must regularly resend your credentials to obtain a new access token.
Example Request
curl -X GET "https://YOUR_DAI_BASE_URL/api/v2/test_results" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
[
{
"id": "test-result-id",
"status": "completed",
"start_time": "2023-06-23T14:55:00Z",
"end_time": "2023-06-23T15:15:00Z"
},
...
]
For more detailed information about each endpoint, including all available parameters and additional examples, please refer to the API V2 Endpoints page.
In Public API Version 2.0, the behavior of all the existing endpoints in Public API Version 1.0 remains the same except for the GET test result logs endpoint (GET api/v2/test_results/{test_result_id}/logs
). In Public API Version 2.0's GET test result logs endpoint, we have now split out all the information that was previously stored in the message
field into their respective columns, message_type
, image_name
, message
and image_id
.
Furthermore, in Public API Version 2.0, we are also introducing new endpoints related to the retrieval of test config results.
Public API Deprecations
Deprecation | Deprecated in DAI Version... | Notes |
---|---|---|
Public API Version 1.0 | DAI Version 7.5 | Public API Version 1.0 is deprecated with the release of Public API Version 2.0. Although it is still currently supported in DAI 7.5, it will be removed in a future release. To prepare for this change, we recommend that you update your usage of the Public API endpoints to Public API Version 2.0. |