No longer need to download objects There is now no need to download resources and host yourself. Just use the public available URL that comes in ONIX directly in customer facing solutions. The Object Download Service provides an endpoint for downloading binary object resources. The path to this service, as well as a unique identifier of the requested object, is returned from the object metadata service, which therefore must be called in advance. The unique identifier is only valid for a certain amount of time, as described in the table below, and can only be called by the same user (credentials) that requested the object export metadata service. The following details the parameters, example usage and different responses when using this service. URL | https://api.boknett.no/metadata/export/object/download
|
---|
Method | GET
|
---|
Request headers | Authorization
| Required | The token acquired from the Authentication Service. Formated "Boknett TGT-...." |
---|
Date
| Required | The timestamp the request was made. Must comply with RFC 1123 date formats. | Accept
| Required | Must be "application/octet-stream" | Query parameters | id
| Required | An unpredictable generated identifier that uniquely references an object representation. Returned in the response from the Object Report Service. Valid for a limited time. |
---|
Response header | Content-Disposition
| Suggests a default filename |
---|
Response body | Object file |
---|
Returns | 200
| OK |
---|
403
| Forbidden | 404
| Not Found | 410
| Gone |
Object sampleRequest objects report and thereafter download service Code Block |
---|
> curl -i -H "Authorization: Boknett TGT-1947-CEwDRwvOiIodyeov31sMnHTn7XxbZH15GDhJDdKWAq1rELH5wU-login.boknett.no" -H "Date: Thu, 12 Jun 2014 13:46:16 GMT" 'https://api.boknett.no/metadata/export/object/?after=20140501000000'
Date: Thu, 12 Jun 2014 13:49:22 GMT
Server: Apache-Coyote/1.1
Next: MTI1MTU0YWE4MDMzIzE0Njc1YmNmZTU3IzhmMzEyZDM=
Link: <https://api.boknett.no/metadata/export/object?next=MTI1MTU0YWE4MDMzIzE0Njc1YmNmZTU3IzhmMzEyZDM=&pagesize=5000>; rel="next"
Content-Type: application/xml
Via: 1.1 api.boknett.no
Transfer-Encoding: chunked
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OBJECTS>
<OBJECT>
<ISBN13>9788202437930</ISBN13>
<EAN>9788202437930</EAN>
<FSSN>150157628</FSSN>
<VAREEIER_KODE>0008</VAREEIER_KODE>
<TYPE>os</TYPE>
<REFERENCE>https://api.boknett.no/metadata/export/object/download?id=xpgZ1kLIardQ%2FWMwitZy02GAyCZzNsnIQTvZSf5LTk6GFDdIAaMGqkXxYoPVCIfy</REFERENCE>
</OBJECT>
...
</OBJECTS>
> curl -JO -H "Accept: application/octet-stream" -H "Authorization: Boknett TGT-1947-CEwDRwvOiIodyeov31sMnHTn7XxbZH15GDhJDdKWAq1rELH5wU-login.boknett.no" -H "Date: Thu, 12 Jun 2014 13:49:22 GMT" https://api.boknett.no/metadata/export/object/download?id=xpgZ1kLIardQ%2FWMwitZy02GAyCZzNsnIQTvZSf5LTk6GFDdIAaMGqkXxYoPVCIfy
curl: Saved to filename 'os.jpg'
|
Note: The -JO flag tells curl to use the server-specified Content-Disposition filename. The response headers are not visible in the above curl command but looks like this: Code Block |
---|
HTTP/1.1 200 OK
Date: Thu, 12 Jun 2014 13:49:22 GMT
Server: Apache-Coyote/1.1
Content-Disposition: attachment; filename="os.jpg"
Content-Type: application/octet-stream
Content-Length: 28805
Via: 1.1 api.boknett.no |
|