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 codeDescription
400Invalid API usage, Resource exists
401Invalid credentials
403Forbidden
404Invalid URI
410Resource deprecated
500Server error
600Invalid password format
601Merge of customers failed
602Customer with this email is already registered
603Invalid email
604Invalid post code
605Invalid telephone number
606Invalid name
610Unauthorized user
611UnAuthenticated
613Cannot restore the customer
614The customer is already active
617Resource not found
618Failed to save resource
619SQL error
621This is a personnel ticket customer and can't be deleted
624Customer 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
}