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.

AddressThe [loan_url] obtained when purchasing the publication.
MethodPOST
Parameters
NameMandatoryDescription
borrower_idYesUsed to identify the end user (who benefits from the loan). Provide a unique alphanumeric identifier of less than 255 characters.
transaction_idYesLoan 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.

durationNo

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.

mediumNo

Indicates which type of access is requested.

Possible values:

- download: Access by downloading

- streaming: Access by online viewing

Default: download

localisationNo

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_addressNoThis 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_urlNoParameter 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_toNoParameter 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
CodeContentDescription
201URLURL of the downloadable time-limited file. Redirect the user to this URL.
400A table of error codesError codes are described below.

invalid_expiration_dateThe expiry date is not valid.

missing_borrower_idThe borrower_id parameter has not been specified.

missing_transaction_idThe transaction_id parameter has not been specified.

no_loan_availableThe 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_requiredThe medium parameter has not been specified.

medium_parameter_invalidThe medium parameter is not valid.

localisation_parameter_requiredThe location parameter has not been specified.

localisation_parameter_invalidThe location parameter is not valid.

ip_address_parameter_requiredThe ip_address parameter has not been specified.

ip_address_parameter_invalidThe ip_address parameter is not valid.

loan_term_limit_reachedThis resource can no longer be loaned because it has reached its expiry date.

loan_duration_over_maximumThe loan period is longer than the maximum allowed.

maximum_simultaneous_downloads_reachedThe maximum number of simultaneous loans has been reached.

maximum_simultaneous_onsite_streamings_reachedThe maximum number of on-site consultations was reached.

maximum_simultaneous_offsite_streamings_reachedThe 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).