メインコンテンツまでスキップ
バージョン: DAI 7.4

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:

  1. Visit the Eggplant DAI UI and log in with your admin credentials.
  2. Navigate to System > API Access.
  3. Click New API Access.
  4. Add a name and description for your credentials.
  5. Click Create.
  6. 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.

Security Note

Treat these credentials as you would a password. Store them securely and do not share them. If 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/v1/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/v1/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 Endpoints page.