Errors
The STIG Viewer API uses standard HTTP status codes to indicate the success or failure of requests.
Error Format
All error responses follow this JSON format:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message"
}
}
Status Codes
| Code | Error Code | Description |
|---|---|---|
| 200 | - | Success |
| 400 | BAD_REQUEST | Invalid query parameters (e.g., invalid format) |
| 401 | UNAUTHORIZED | Missing, invalid, or expired token |
| 404 | NOT_FOUND | STIG not found with the specified slug |
| 500 | INTERNAL_ERROR | Server error |
Examples
401 - Unauthorized
{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid Authorization header"
}
}
400 - Bad Request
{
"error": {
"code": "BAD_REQUEST",
"message": "Invalid format. Must be one of: json, csv, xml"
}
}
404 - Not Found
{
"error": {
"code": "NOT_FOUND",
"message": "STIG not found: invalid-slug"
}
}