Error handling and reporting

HTTP responses

Even tough explicitly mentioned in each API description there is a set of basic HTTP responses that due to an error (either in your request or internally in DDS) can be returned to your application. It is imperativ that you handle these errors with care and take action according to the type of errors you receive. The HTTP response code is your first and best guide to understand what has happened.

 

Typical error HTTP responses and their meaning

 

CodeMeaningAction
400Bad request. Usually means that your request was not sufficient for the API to handle your request.Debug code, contact Bokbasen for assistance if needed.
401Unauthorized. Something is wrong with your authentication header, most of the time either your TGT has expired or your are missing the bearer token (Bokbasen) before the TGT in the header.Recreate TGT. If that does not help: Debug code, contact Bokbasen for assistance if needed.
404Not found. Something is wrong with your URL and you requested a resource that does not exist.Debug code, contact Bokbasen for assistance if needed.
405Method not allowed. Check your request method, if you e.g. try to retrieve a resource using POST, this is the error you will get.Debug code, contact Bokbasen for assistance if needed.
500Internal server error. An unknown error occurred.Contact Bokbasen following the reporting errors guidelines

 

Reporting errors guidelines

Bokbasen is happy to support you in your efforts on integrating towards our APIs, but in order to give sufficient help we need enough information for us to be able to do that. When sending a request regarding problems with and API call, please always include:

 

  • The URL your request
  • The HTTP headers in your request
  • HTTP code and headers in the response from Bokbasen

See below for an example how such a message could look like (requests can be done both in English and Norwegian). 

 

Hi Bokbasen,

I am having problems with the get content API. Every time I send a request I get a 401 response, please see below for details on my request and responses.

 

Request URL

https://api.dds.boknett.webbe.no/content/755f943c-2644-413f-8e0c-4e16f38cfdf1

Request Headers

Authorization: TGT-27154-xSYlTutzpes5v32hOHKFcbmbGVAUkb3I5iZt21fAdO1qGJ3taK-login.boknett.no"
Date: Wed, 12 Aug 2015 09:22:00 GMT
 

Response from DDS:

HTTP/1.1 404 Not Found
Date: Mon, 17 Aug 2015 16:35:00 GMT
Server: Apache-Coyote/1.1
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 949
Via: 1.1 api.dds.boknett.webbe.no
<html><head><title>Apache Tomcat/7.0.34 - Error report</title><style>
 

Regards,

Ola Nordmann

Senior Developer