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 /v1/checkouts

    {
    "recordId": "<record id>"
    }
record id The content provider record id.

Response

    {
    "id": "<checkout id>",
    "formatMetadata": {
      "<format id>": {
          "contentLinks": "<content links>",
          "supplementLinks": "<supplement links>",
       }
    }
    "expirationDate": "<expiration date>"
    }
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 ISO 8601 format.

Example request:

POST /v1/checkouts

{
    "recordId": "recordId_0"
}

Example response:

{
  "id": "checkoutId",
  "formatMetadata": {
    "ebook": {
      "contentLinks": [
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/ebook/content_0"
        },
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/ebook/content_1"
        }
      ],
      "supplementLinks": [
        {
          "name": "supplement_0",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/ebook/supplement_0"
        },
        {
          "name": "supplement_1",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/ebook/supplement_1"
        }
      ]
    },
    "audio-stream": {
      "contentLinks": [
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-stream/content_0"
        },
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-stream/content_1"
        }
      ],
      "supplementLinks": [
        {
          "name": "supplement_0",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-stream/supplement_0"
        },
        {
          "name": "supplement_1",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-stream/supplement_1"
        }
      ]
    },
    "audio-downloadable": {
      "contentLinks": [
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-downloadable/content_0"
        },
        {
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-downloadable/content_1"
        }
      ],
      "supplementLinks": [
        {
          "name": "supplement_0",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-downloadable/supplement_0"
        },
        {
          "name": "supplement_1",
          "href": "http:/localhost:16521/ep/api/v1/records/recordId_0/audio-downloadable/supplement_1"
        }
      ]
    }
  },
  "expirationDate": "2016-01-01T00:00:00Z"
}