To lend a publication, the library's lending system must use the lending URL obtained when the publication was purchased (this URL was provided by the bookseller who sold the resource to the library). A call to this URL, with some specific parameters, will return a second URL that allows access to the resource.
Address | The [loan_url] obtained when purchasing the publication. |
|---|
Method | POST |
|---|
Parameters | | Name | Mandatory | Description |
|---|
| borrower_id | Yes | Used to identify the end user (who benefits from the loan). Provide a unique alphanumeric identifier of less than 255 characters. | | transaction_id | Yes | Loan reference number. Provide a unique alphanumeric identifier of less than 255 characters. | | expire_at | Yes
| End date of the loan, in ISO-8601 basic format (YYYYMMDD or YYYYMMDDTHHMMSS). The loan end date must be within 59 days of the start of the loan. | | duration | No | Number of days the resource will be accessible, starting from the time of download (in the case of a time-limited download). If expire_at and duration are omitted, the default number will be the maximum duration accepted by the publisher. | | medium | No | Indicates which type of access is requested. Possible values: - download: Access by downloading - streaming: Access by online viewing Default: download | | localisation | No | In the case of access by consultation (medium=streaming), this parameter becomes mandatory and indicates from where the access is made. Possible values: - on-site: Access is from within the library walls - off-site: Access is from outside the library walls | | ip_address | No | This parameter is required when medium=streaming and localization=on-site. | If you want to be notified when a user returns the book before the loan expires, so as to make the title available again, add the notify_url parameter: | | notify_url | No | Parameter to be provided by the entity operating the loan. The URL must be correctly encoded. Ex.: "http://www.pret.com/api/notify/loan/transaction_id/12345/". | | bill_drm_to | No | Parameter to be provided by the entity operating the loan. The value of this parameter must be the alphanumeric identifier of the lending system obtained from the platform. Enables the platform to generate a custom DRM fee billing report for each loan source. |
|
|---|
Réponses | | Code | Content | Description |
|---|
| 201 | URL | URL of the downloadable time-limited file. Redirect the user to this URL. | | 400 | A table of error codes | Error codes are described below. |
| invalid_expiration_date | The expiry date is not valid. |
| missing_borrower_id | The borrower_id parameter has not been specified. |
| missing_transaction_id | The transaction_id parameter has not been specified. |
| no_loan_available | The link is not valid or the book is already on loan. |
| maximum_loans_q ty_reached | The publication cannot be borrowed because the loan limit has been reached. |
| medium_parameter_required | The medium parameter has not been specified. |
| medium_parameter_invalid | The medium parameter is not valid. |
| localisation_parameter_required | The location parameter has not been specified. |
| localisation_parameter_invalid | The location parameter is not valid. |
| ip_address_parameter_required | The ip_address parameter has not been specified. |
| ip_address_parameter_invalid | The ip_address parameter is not valid. |
| loan_term_limit_reached | This resource can no longer be loaned because it has reached its expiry date. |
| loan_duration_over_maximum | The loan period is longer than the maximum allowed. |
| maximum_simultaneous_downloads_reached | The maximum number of simultaneous loans has been reached. |
| maximum_simultaneous_onsite_streamings_reached | The maximum number of on-site consultations was reached. |
| maximum_simultaneous_offsite_streamings_reached | The maximum number of off-site consultations was reached. |
|
|---|
If you need to regenerate a download link for an existing loan (for example, for a user who has lost their file), simply use this service again, using the same values for the borrower_id and transaction_id parameters and omitting the expire_at parameter.
The notification URL ([notify_url]) can be specific to each loan, like this: "http://www.pret.com/api/notify/loan/transaction_id/12345/" or generic (the same link for each loan, e.g. "http://www.pret.com/api/notify") since the platform already sends the loan information in the request that is made to the notification URL (see next step).