TESTMETRIX API Reference
TESTMETRIX exposes a fully documented REST API built with Django REST Framework and documented with drf-spectacular (OpenAPI 3).
Interactive Documentation
The easiest way to explore the API is via the hosted Swagger UI:
https://testmetrix.de/api/schema/swagger-ui/
The raw OpenAPI 3 schema is available at:
https://testmetrix.de/api/schema/
Authentication
All API endpoints require authentication. TESTMETRIX uses Token authentication.
Obtain a Token
curl -X POST https://testmetrix.de/api/auth/token/ \
-H "Content-Type: application/json" \
-d '{"username": "your_username", "password": "your_password"}'
Response:
{
"token": "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
}
Use the Token
Include the token in the Authorization header for all subsequent requests:
curl https://testmetrix.de/api/projects/ \
-H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
Key Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /api/projects/ | List all projects |
POST | /api/projects/ | Create a project |
GET | /api/projects/{id}/ | Get project details |
GET | /api/test-cases/ | List test cases |
POST | /api/test-cases/ | Create a test case |
GET | /api/test-runs/ | List test runs |
POST | /api/test-runs/ | Create a test run |
POST | /api/test-results/ | Upload a test result |
GET | /api/coverage/ | Get coverage data |
Pagination
List endpoints are paginated. The default page size is 20. Use ?page=2 to navigate.
{
"count": 142,
"next": "https://testmetrix.de/api/test-cases/?page=2",
"previous": null,
"results": [...]
}
Filtering
Most list endpoints support filtering via query parameters:
# Get test cases in project 3 with category "Safety"
GET /api/test-cases/?project=3&category=Safety
# Get all failed results in run 42
GET /api/test-results/?run=42&status=fail
CI/CD Integration Example
Here is a minimal shell script to upload test results from a CI pipeline:
#!/bin/bash
# upload-results.sh — run after your test suite completes
API_URL="https://testmetrix.de/api"
TOKEN="${TESTMETRIX_API_TOKEN}"
RUN_ID="${TESTMETRIX_RUN_ID}"
upload_result() {
local test_case_id=$1
local status=$2 # pass | fail | blocked
local duration_ms=$3
curl -sS -X POST "${API_URL}/test-results/" \
-H "Authorization: Token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"run_id\": ${RUN_ID},
\"test_case_id\": ${test_case_id},
\"status\": \"${status}\",
\"duration_ms\": ${duration_ms}
}"
}
# Example calls
upload_result 7 "pass" 234
upload_result 8 "fail" 512
upload_result 9 "blocked" 0
Set TESTMETRIX_API_TOKEN and TESTMETRIX_RUN_ID as CI/CD variables in your GitLab project.
Full Schema
For the complete, up-to-date API specification, refer to the hosted docs:
- Swagger UI — try endpoints interactively
- OpenAPI YAML — download the raw schema