Problem types
This page contains more detailed information about the commonly used “problems”/errors that are returned from our API’s.
API problems are normally formatted as Problem Details and should contain a descriptive title as well as a type
URI that points “here”.
This response contain this header Content-Type: application/problem+json
and normally looks somewhat like this:
{
"type": "https://developer.spvapi.no/problems#validation",
"title": "Missing x-request-id",
"detail": "string",
"validation": [
{
"location": [
"request",
"header"
],
"severity": "Error",
"code": "required",
"message": "should have required property 'x-request-id'"
}
]
}
No content
The server processed the request successfully, but is not returning any content.
Validation
The client’s request did not pass validation. This could mean that some required fields, headers or parameters are missing or is wrongly formatted.
The API’s contract and your request’s problem reponse should contain exact details on what did not pass validation and the requirements of the request.
Typical examples include:
- Missing x-request-id
- Wrongly formatted uuid or date
- Number presented as string(with quotes)
Not found
The resource you are requesting is not found. This can either be that the resource simply does not exist, or it does not exist “for you”.
The reason for sometimes indicating “not found” instead of “forbidden” is to not imply that the resource actually exist. This is information in-itself that we sometimes do not want to share.
This type also has other more specific variants like customer-not-found or account-not-found
Customer not found
The customer you are trying to access, is not found. As not-found this can either mean that the customer does not exist, or is not available for this client(you).
Account not found
The account you are trying to access, is not found. As not-found this can either mean that the account does not exist, or is not available for this client(you).
Not authorized
The resource exists, but you are not authorized to perform the requested operation on it. The client should be able to inspect their access token and compare scopes
with the corresponding operations in the API’s contract. The title
field should also contain a more descriptive reason for why you are not allowed to perform this operation.
Other more specific variants of this problem might also exist.
Method not allowed
The requested method is not supported. For example a PUT method on a resource that is read-only.
Unsupported media type
The request entity has a media type that is unsupported. For example when the server expects the media type to be application/hal+json, but text/html is provided.
Server error
Something unexpected happened on the server that we were unable to properly handle. If the title
does not contain more information about how to handle this error, please contact us with your request-id to find out what is wrong.
Dependent service error
The service was unavailable to fullfill the request due to issues with an external dependency. Try again later.