Tests API
Manage API tests programmatically.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/tests | List all tests |
| GET | /api/tests/:id | Get a specific test |
| POST | /api/tests | Create a new test |
| PUT | /api/tests/:id | Update a test |
| DELETE | /api/tests/:id | Delete a test |
| POST | /api/tests/:id/run | Run a test immediately |
| POST | /api/tests/:id/pause | Pause a test |
| POST | /api/tests/:id/resume | Resume a paused test |
| GET | /api/tests/:id/results | Get test results |
List Tests
bash
GET /api/testsResponse:
json
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production API Health",
"url": "https://api.example.com/health",
"httpMethod": "GET",
"frequencyMinutes": 5,
"status": "Active",
"importance": "Production",
"lastRunAt": "2024-01-24T15:30:00Z",
"lastRunSuccess": true
}
]Get Test
bash
GET /api/tests/:idResponse includes full test configuration.
Create Test
bash
POST /api/tests
Content-Type: application/json
{
"name": "API Health Check",
"httpMethod": "GET",
"url": "https://api.example.com/health",
"frequencyMinutes": 5,
"timeoutMs": 30000,
"importance": "Production",
"assertions": [
{
"type": "StatusCode",
"expected": "2xx",
"stopOnFailure": true
}
]
}Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Test name |
httpMethod | string | Yes | HTTP method |
url | string | Yes | Endpoint URL |
description | string | No | Test description |
tags | string[] | No | Tags for filtering |
headers | object | No | Request headers |
body | string | No | Request body |
bodyType | string | No | Body type (json, form, xml) |
authType | string | No | Auth type |
authConfig | object | No | Auth configuration |
assertions | array | No | Assertions to validate |
frequencyMinutes | number | No | Run frequency (default: 60) |
timeoutMs | number | No | Request timeout (default: 30000) |
importance | string | No | Importance level (default: Production) |
timezone | string | No | Timezone for active hours |
activeHoursStart | string | No | Active hours start (HH:mm) |
activeHoursEnd | string | No | Active hours end (HH:mm) |
Update Test
bash
PUT /api/tests/:id
Content-Type: application/json
{
"name": "Updated Name",
"frequencyMinutes": 1
}Only include fields you want to change.
Delete Test
bash
DELETE /api/tests/:idReturns 204 No Content on success.
Run Test
Execute a test immediately, outside its normal schedule:
bash
POST /api/tests/:id/runResponse includes the test result.
Pause/Resume Test
bash
POST /api/tests/:id/pause
POST /api/tests/:id/resumeGet Results
bash
GET /api/tests/:id/results?limit=100&offset=0Response:
json
[
{
"id": "...",
"testId": "...",
"success": true,
"statusCode": 200,
"responseTimeMs": 145,
"executedAt": "2024-01-24T15:30:00Z"
}
]Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 100 | Results per page |
offset | number | 0 | Results to skip |
Assertion Format
json
{
"type": "StatusCode",
"expected": "2xx",
"stopOnFailure": true
}| Type | Fields |
|---|---|
StatusCode | expected: Status pattern |
ResponseTime | thresholdMs: Max milliseconds |
JsonPath | path, expected: JSONPath and value |
Contains | expected: Text to find |
Regex | pattern: Regex pattern |
HeaderExists | expected: Header name |
HeaderValue | path (header name), expected (value) |