Errors

Error Responses

Fail Fast

TruckMate’s REST APIs follow the fail fast principle. The API Server makes use of the OpenAPI specification to validate input prior to moving onto database and business logic validations. If any failures are found no further processing will be performed.

1. Path Validation

Ensure that the URL path of the API request is correctly formatted, meeting the expectations of the API endpoint.

2. Authentication and Authorization

Verify the identity of the client making the API request, ensuring the necessary credentials allow to access the requested resource. Ensure the authenticated client has the appropriate permissions for the requested endpoint and method.

3. Query String Validation

All query string parameters sent with the request will be validated to ensure that the endpoint supports the parameter, and the parameter supports the value.

4. OpenAPI Schema Validation

Before processing, an initial introspection will be conducted to consolidate any OpenAPI-related errors. If the request deviates from the corresponding OpenAPI specification, a comprehensive summary of all problems will be included in the response body as part of the errors array.

5. Business Logic and Database Value Validations

Business logic errors will be return individually. Business logic errors often require SQL statements to be run, in favor of performance and to minimize the SQL statements run, the first error found will end processing and return the error response to the user.

Error Messages

Errors are returned using standard HTTP Response Codes. Any additional information pertaining to the error will be included in the response body. Please see below table containing the list of currently used error codes and their associated messages:

Status CodeError CodeAssociated Message
301movedPermanentlyThe endpoint has been moved permanently. Please refer to the OpenAPI Specification for a list of supported methods and endpoints.
401unauthorizedThe supplied authentication credentials are not valid.
403forbiddenThe supplied authentication credentials are not sufficient to access the resource, or perform the requested operation.
404resourceNotFoundNot found. The server has not found anything matching the Request-URI.
405methodNotAllowedMethod not allowed. Please refer to the OpenAPI Specification for a list of supported methods and endpoints.
409resourceConflictThe supplied authentication credentials are not valid.
420licenseNotAvailableLicense not available.
429tooManyRequestsToo many requests.
500serverErrorServer error.
400belowMinValue{field} cannot be less than the minimum value of {value}.
400exceedsMaxLength{field} is expected to not exceed maximum length of {value} character(s).
400invalidJsonArray{field} is expected to be a valid JSON array.
400invalidJsonObject{field} is expected to be a valid JSON object.
400noValidFieldsNo valid fields sent with the request. Please refer to the OpenAPI Specification for a list of supported fields.
400invalidJsonValue{field} is expected to satisfy one of the following conditions: {oneOf conditions}.
400invalidDateTime{field} is expected to be a valid datetime string (yyyy-MM-ddThh:mm
).
400invalidDate{field} is expected to be a valid date string (yyyy-MM-dd).
400invalidTime{field} is expected to be a valid time string (hh
).
400invalidPattern{field} does not match the pattern defined in the OpenAPI specification.
400invalidFormat{field} is expected to be in the valid format.
400invalidDouble{field} is expected to be a valid double.
400invalidEnum{field} is expected to be a value of {enum values}.
400invalidInteger{field} is expected to be a valid integer.
400invalidString{field} is expected to be a valid string.
400missingRequiredField{field} is a required field.
400invalidQueryParameterQuery parameter {parameter} is not supported for this endpoint.
400invalidDBValue{field} is not a valid {label}.
400invalidBusinessLogicThis will be unique depending on the business use case, this could be related to configuration options or other logic.