Errors
HTTP Response Codes
Status Code | Error | Description |
---|---|---|
400 | Bad Request | Usually sent when there's a domain level error, for example, attempting to update a job that has already finished. |
401 | Unauthorized | We could not verify your identity from the API key contained in the request. |
403 | Forbidden | The user is not allowed to make the request, this could be due to an invalid API key or because you're attempting to access a job that does not belong to you. |
404 | Not Found | Shows that either the endpoint or the resource trying to be accessed does not exist. |
422 | Unprocessable Entity | There was an error in the data sent to the server, most likely the validation of part of the request has failed. |
500 | Server Error | There is an issue on Gophr's side. If you see this error, please let us know. |
General Format
When error descriptions are available, they will be returned to the client with an errors
array. Each object within the array will contain the following fields:
object
- Shows the specific field that the error relates to if appropriatecode
- The error code (see Codes section below).message
- A human readable description of the error that has occured.
For example:
{
"errors": [
{
"object": null,
"code": "INVALID_JOB_OPERATION",
"message": "Job with id 20220607-113253-0445d443cf69a505 is confirmed and so cannot be modified."
}
]
}
Validation Errors
Basic Error
If validation has failed for a field not contained within a collection, the error (and specifically the object
field) will appear in the following format:
{
"errors": [
{
"object": "pickup_postcode",
"code": "VALIDATION_FAILED",
"message": "Field must be a string"
}
]
}
Collection Validation Errors
Where validation has failed for a field contained within a collection of items, dot (.
) notation is used to allow you to identify the field that has failed. For example, given the following request data where the parcel_insurance_value
is of an invalid type for the first item in the parcels
collection:
{
"pickup": {...},
"dropoff": {...},
"parcels": [
{
"parcel_insurance_value": "This field should be a float",
...
}
]
}
The following response would be returned:
{
"errors": [
{
"object": "parcels.0.parcel_insurance_value",
"code": "VALIDATION_FAILED",
"message": "Field must be a number"
}
]
}
Codes
Error Code | Description |
---|---|
ERROR_CONFIGURATION | API configuration issue on Gophr's side. |
ERROR_JOB_STATUS | Cannot perform this action because of current job status. |
ERROR_JOB_FINISHED | Cannot perform this action on a job, because it is finished or cancelled. |
INVALID_JOB_OPERATION | General error stating that the operation being attempted on the job cannot be completed. e.g. trying to add a delivery to a confirmed job. |
VAILIDATION_FAILED | A field or query param sent to the server does comply with our validation rules. |
UNAUTHORIZED | The request did not contain a valid API Key header or the operation is forbidden. |
Updated over 2 years ago