Errors
We use standard HTTP response codes for success and failure. In general, 200 HTTP codes correspond to success, 40X codes are for developer- or user-related failures, and 50X codes are for internal API issues. The customer API has two different error responses dependent on the URI used. We are working on returning the same response for all our endpoints, but this will not happen before next version because we need to keep the API backward compatible.
Profiles and consents
You can expect this error for URI starting with:
/profiles
/consents
{
"errorCode": 0,
"shortNorwegian": "string",
"longNorwegian": "string",
"shortEnglish": "string",
"longEnglish": "string"
}
The errorCode are custom API error codes explained here:
Status code | Description |
---|---|
400 | Invalid API usage, Resource exists |
401 | Invalid credentials |
403 | Forbidden |
404 | Invalid URI |
410 | Resource deprecated |
500 | Server error |
600 | Invalid password format |
601 | Merge of customers failed |
602 | Customer with this email is already registered |
603 | Invalid email |
604 | Invalid post code |
605 | Invalid telephone number |
606 | Invalid name |
610 | Unauthorized user |
611 | UnAuthenticated |
613 | Cannot restore the customer |
614 | The customer is already active |
617 | Resource not found |
618 | Failed to save resource |
619 | SQL error |
621 | This is a personnel ticket customer and can't be deleted |
624 | Customer account alias already exists |
Benefits
The other endpoints will be returning errors in the following format. As mentioned, this is the format we will use going forward with the API(new major versions).
{
"timestamp": "string" // When the error occurred
"status" : "string", // The http status code
"error": "string", // The http status reason
"path": "string", // The request URI
"message": "string", // The error message
"errors": "list" // Optional list of error specifications
}