checkout

Creates a new checkout. If there already exists a checkout for given patron credentials, record id then the provider should respond with internal error: ALREADY_ON_LOAN. See: eHUB Provider API Error Handling

Request

POST /v3/checkouts

{
    "fields":{
        "contentProviderAlias":"<content provider alias>",
        "contentProviderRecordId":"<record id>",
        "contentProviderFormatId":"<format id>",
        "lmsRecordId":"<lms record id>",
        "contentProviderIssueId":"<issue id>"
    }
}
<content provider alias> The content provider alias.
<record id> The content provider record id.
<format id> The content provider format id.
<lms record id> Lms record id.
<issue id> The content provider issue id (optional).

Response

{
    "metadata":{
        "id":<checkout id>,
        "lmsLoanId":"<lms loan id>",
        "contentProviderLoanId":"<content provider loan id>",
        "expirationDate":<expiration date>,
        "format":{
            "id":"<format id>",
            "name":"<format name>",
            "description":"<format description>",
            "contentDisposition":"<content disposition>"
        }
    },
    "contentLinks":[
        {"href":"<content url>"},
        {"href":"<content url>"}
    },
    "supplementLinks": [
        {"href":"<supplement link url>", "name": "<supplement link name>"},
        {"href":"<supplement link url>", "name": "<supplement link name>"}
    ]
}
<checkout id> The checkout id.
<format metadata> The format metadata is a JSON object with properties of format id. The value of each property is an object with value of properties "<content links>" and "<supplement links>" where:
<content links> The media content links array. Every element in the array is an object with singleton property <href>. The property specifies the media url.
<supplement links> The media supplement links array. Every element in the array is an object with properties <name> and <href>. The <name> property specifies the supplement link name and <href> specifies the supplement material url.
<expiration date> The checkout expiration date in seconds since epoch. See Epoch & Unix Timestamp Conversion Tools

Example request:

POST /v3/checkouts

{
    "fields":{
        "contentProviderAlias":"Elib3",
        "contentProviderRecordId":"1018016",
        "contentProviderFormatId":"4002",
        "lmsRecordId":"123456"
    }
}

Example response:

{
    "metadata":{
        "id":1271261,
        "lmsLoanId":"7462892",
        "contentProviderLoanId":"18727936",
        "expirationDate":1494374400000,
        "format":{
            "id":"4002",
            "name":"Listen on computer",
            "description":"E-audiobook played in browser, Flash is required",
            "contentDisposition":"DOWNLOADABLE"
        }
    },
    "contentLinks":[
        {"href":"https://zebservices.elib.se/v2/Fulfillment/?data=xxxxx"},
        {"href":"https://zebservices.elib.se/v2/Fulfillment/?data=yyyyy"}
    },
    "supplementLinks": [
        {"href":"https://zebservices.elib.se/v2/Fulfillment/?data=ttttt", "name": "Supplement 1"},
        {"href":"https://zebservices.elib.se/v2/Fulfillment/?data=zzzzz", "name": "Supplement 2"}
    ]
}