The export service provides alternatives for retrieving metadata and objects from Bokbasen. This pages contains general information covering all export services, see individual sub pages for the different data and formats that can be retrieved.
Table of Contents |
---|
Pagination
All reports will require one of two parameters; “after” or “next”. The usage of the two parameters differs slightly. The HTTP response will always contain a token that represents a specific “internal timestamp” and can be used as a “cursor”. This token can be used in the next request to get all changes since the last request. The maximum allowed age a of both parameters is currently 180 days but might change in the future. If a customer needs to fetch older information than this, please contact Bokbasen on a case by case basis.
...
In case the request fails due to validation of request headers or input parameters the client will receive a response consisting of an xml explaining the cause of failure. The elements of the error xml are listed below. For some errors there may be additional elements included for better explanation of the error cause. For non-xml formated reports the response will be in plain text instead of xml.
Code Block | ||
---|---|---|
| ||
HTTP/1.1 HTTP_STATUS_CODE MESSAGE Date: Tue, 01 Apr 2014 10:49:04 GMT Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code></code> <message></message> <error> <errors> |
Restrictions
Restriction | Current value |
---|---|
Default (and max) pagesize for |
ONIX | 1000 |
Default (and max) pagesize for Object Report | 5000 |
Maximum age of after and next parameters | 180 days |
Maximum age of Object reference link | 24 hours |
Allowed time skew between server and Date in request header | 15 minutes |
Pagination and Pagesize sample
...
Code Block |
---|
> curl -i -H "Authorization: Boknett TGT-906-Jaemq9xyI5vDRsy6qs27cubbKQIogwFFccjOgK4GYLB5IFT6E0-login.boknett.no" -H "Date: Wed, 11 Jun 2014 19:05:44 GMT" 'https://api.boknett.no/metadata/export/bokbasenxml?subscription=extended&pagesize=100&after=20140501120000' Date: Wed, 11 Jun 2014 19:11:20 GMT Server: Apache-Coyote/1.1 Next: MTI1MTUzNzhjMGQzIzE0Njc1YmFjNDlmIzhmMmU5YTU= Link: <https://api.boknett.no/metadata/export/bokbasenxml?next=MTI1MTUzNzhjMGQzIzE0Njc1YmFjNDlmIzhmMmU5YTU=&subscription=extended&pagesize=100>; rel="next" Content-Type: application/xml Via: 1.1 api.boknett.no Transfer-Encoding: chunked <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <LEVERANSE xmlns="http://api.boknett.no/metadata/export/bokbasenxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api.boknett.no/schema/bokbasenxml-1.0.xsd"> ... (1-100 records of 150 returned) </LEVERANSE> > curl -i -H "Authorization: Boknett TGT-906-Jaemq9xyI5vDRsy6qs27cubbKQIogwFFccjOgK4GYLB5IFT6E0-login.boknett.no" -H "Date: Wed, 11 Jun 2014 19:05:44 GMT" 'https://api.boknett.no/metadata/export/bokbasenxml?next=MTI1MTUzNzhjMGQzIzE0Njc1YmFjNDlmIzhmMmU5YTU=&subscription=extended&pagesize=100' Date: Wed, 11 Jun 2014 19:12:45 GMT Server: Apache-Coyote/1.1 Next: MTI1MTUzNzhjMTBjIzE0Njc1YmUyZjY0IzhmMzJhNWM= Link: <https://api.boknett.no/metadata/export/bokbasenxml?next=MTI1MTUzNzhjMTBjIzE0Njc1YmUyZjY0IzhmMzJhNWM=&subscription=extended&pagesize=100>; rel="next" Content-Type: application/xml Via: 1.1 api.boknett.no Transfer-Encoding: chunked <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <LEVERANSE xmlns="http://api.boknett.no/metadata/export/bokbasenxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api.boknett.no/schema/bokbasenxml-1.0.xsd"> ... (101-150 of 150 records returned) </LEVERANSE> >curl -i -H "Authorization: Boknett TGT-906-Jaemq9xyI5vDRsy6qs27cubbKQIogwFFccjOgK4GYLB5IFT6E0-login.boknett.no" -H "Date: Wed, 11 Jun 2014 19:10:46 GMT" 'https://api.boknett.no/metadata/export/bokbasenxml?next=MTI1MTUzNzhjMTBjIzE0Njc1YmUyZjY0IzhmMzJhNWM=&subscription=extended&pagesize=100' Date: Wed, 11 Jun 2014 19:12:45 GMT Server: Apache-Coyote/1.1 Next: MTI1MTUzNzhjMTBjIzE0Njc1YmUyZjY0IzhmMzJhNWM= Content-Type: application/xml Via: 1.1 api.boknett.no Transfer-Encoding: chunked (No more records. Next unchanged. Link not present in Response) |
...
Parameter Error
Request with valid Authorization token and Date. But is missing mandatory parameter subscription.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett TGT-2-alOe0gIWn4xWh1kVfHpIjcqPgcvoRbHw1AsnoqnlBh41udbEQe-login.boknett.no" -H "Date: Wed, 02 Apr 2014 14:45:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?after=20140319100000 HTTP/1.1 400 Bad Request Content-Type: application/xml Transfer-Encoding: chunked Server: Jetty(8.1.14.v20131031) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>subscription</code> <message>may not be null</message> </error> </errors> |
...
Request with valid Authorization token and Date. But is missing next or after parameter.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett TGT-2-alOe0gIWn4xWh1kVfHpIjcqPgcvoRbHw1AsnoqnlBh41udbEQe-login.boknett.no" -H "Date: Wed, 02 Apr 2014 14:45:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic HTTP/1.1 400 Bad Request Content-Type: application/xml Transfer-Encoding: chunked Server: Jetty(8.1.14.v20131031) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>nextAndAfterValid</code> <message>Either parameter next or after must be given. Not both.</message> </error> </errors> |
Missing Headers Error
Request missing required headers.
Code Block | ||
---|---|---|
| ||
> curl -i https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 400 Bad Request Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>MissingDateHeader</code> <message>Missing date header</message> </error> <error> <code>MissingAuthorizationHeader</code> <message>Missing authorization header</message> </error> </errors> |
Date Header Error
Request with valid Authorization token, and a Date of invalid format.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett TGT-2-alOe0gIWn4xWh1kVfHpIjcqPgcvoRbHw1AsnoqnlBh41udbEQe-login.boknett.no" -H "Date: 02.04.2014 11:59:00" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 400 Bad Request Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>WrongDateFormat</code> <message>Invalid format: 02.04.2014 11:59:00</message> </error> </errors> |
Request with valid Authorization token, and a Date that is of valid format but is not within the boundary of 15 minutes skew.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett TGT-2-alOe0gIWn4xWh1kVfHpIjcqPgcvoRbHw1AsnoqnlBh41udbEQe-login.boknett.no" -H "Date: Wed, 02 Apr 2014 11:59:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 400 Bad Request Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>RequestTimeTooSkewed</code> <message>The difference between the request time and the current time is too large</message> <maxAllowedSkewMilliseconds>900000</maxAllowedSkewMilliseconds> <requestTime>Wed, 02 Apr 2014 11:59:00 GMT</requestTime> <serverTime>Wed, 02 Apr 2014 14:26:35 GMT</serverTime> </error> </errors> |
...
Authorization Header Error
...
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett TGT-1-alOe0gIWn4xWh1kVfHpIjcqPgcvoRbHw1AsnoqnlBh41udbEQe-login.boknett.no" -H "Date: Wed, 02 Apr 2014 14:45:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 401 Unauthorized Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>AuthenticationFailed</code> <message>TICKET_NOT_FOUND</message> </error> </errors> |
...
Request with valid Authorization prefix but invalid token and valid Date.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: Boknett LETMEIN" -H "Date: Wed, 02 Apr 2014 14:45:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 401 Unauthorized Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>AuthenticationFailed</code> <message>INVALID_TICKET</message> </error> </errors> |
...
Request with invalid Authorization prefix and valid Date.
Code Block | ||
---|---|---|
| ||
> curl -i -H "Authorization: LETMEIN" -H "Date: Wed, 02 Apr 2014 14:45:00 GMT" https://api.boknett.no/metadata/export/bokbasenxml?subscription=basic&after=20140319100000 HTTP/1.1 403 Forbidden Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>AccessDenied</code> <message>No authorization found for given parameter combination</message> </error> </errors> |
System Error
When the request is fine, but an unexpected error occurs at the server side, the client will receive the following response.
Code Block | ||
---|---|---|
| ||
HTTP/1.1 500 Server Error Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors> <error> <code>SystemError</code> <message>Something went wrong, please contact Bokdatabasen for more information</message> </error> </errors> |
Referenced documents
Document | Description |
---|---|
Onix documentation | See editeur.org where descriptions, schemas and etc is located. |
Bokbasen XML Specification | Separate specification of Bokbasen XML and the different subscriptions. "Bokbasen XML_export_EKSTERN.xlsx" Delivered on request. |
Bokbasen XML Schema | https://api.boknett.no/schema/bokbasenxml-<version>.xsd |
Bokbasen ONIX Schema | https://api.boknett.no/schema/ONIX_BookProduct_3.0_reference.xsd |
...