Skip to content

Tests API

Manage API tests programmatically.

Endpoints

MethodEndpointDescription
GET/api/testsList all tests
GET/api/tests/:idGet a specific test
POST/api/testsCreate a new test
PUT/api/tests/:idUpdate a test
DELETE/api/tests/:idDelete a test
POST/api/tests/:id/runRun a test immediately
POST/api/tests/:id/pausePause a test
POST/api/tests/:id/resumeResume a paused test
GET/api/tests/:id/resultsGet test results

List Tests

bash
GET /api/tests

Response:

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/:id

Response 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

FieldTypeRequiredDescription
namestringYesTest name
httpMethodstringYesHTTP method
urlstringYesEndpoint URL
descriptionstringNoTest description
tagsstring[]NoTags for filtering
headersobjectNoRequest headers
bodystringNoRequest body
bodyTypestringNoBody type (json, form, xml)
authTypestringNoAuth type
authConfigobjectNoAuth configuration
assertionsarrayNoAssertions to validate
frequencyMinutesnumberNoRun frequency (default: 60)
timeoutMsnumberNoRequest timeout (default: 30000)
importancestringNoImportance level (default: Production)
timezonestringNoTimezone for active hours
activeHoursStartstringNoActive hours start (HH:mm)
activeHoursEndstringNoActive 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/:id

Returns 204 No Content on success.

Run Test

Execute a test immediately, outside its normal schedule:

bash
POST /api/tests/:id/run

Response includes the test result.

Pause/Resume Test

bash
POST /api/tests/:id/pause
POST /api/tests/:id/resume

Get Results

bash
GET /api/tests/:id/results?limit=100&offset=0

Response:

json
[
  {
    "id": "...",
    "testId": "...",
    "success": true,
    "statusCode": 200,
    "responseTimeMs": 145,
    "executedAt": "2024-01-24T15:30:00Z"
  }
]

Query Parameters

ParameterTypeDefaultDescription
limitnumber100Results per page
offsetnumber0Results to skip

Assertion Format

json
{
  "type": "StatusCode",
  "expected": "2xx",
  "stopOnFailure": true
}
TypeFields
StatusCodeexpected: Status pattern
ResponseTimethresholdMs: Max milliseconds
JsonPathpath, expected: JSONPath and value
Containsexpected: Text to find
Regexpattern: Regex pattern
HeaderExistsexpected: Header name
HeaderValuepath (header name), expected (value)

Pingward - API Monitoring Made Simple