Integration with OverDrive API (v.2) needed

Bug #1818144 reported by Beth Willis
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Undecided
Unassigned
3.1
Won't Fix
Undecided
Unassigned
3.2
Won't Fix
Undecided
Unassigned
3.3
Won't Fix
Undecided
Unassigned
3.4
Won't Fix
Undecided
Unassigned
3.5
Won't Fix
Undecided
Unassigned

Bug Description

Evergreen v.3.1
Chrome v.72.0.3626.109, Firefox v.64.0.2

OverDrive Inc. has released an update to the Library Availability API. According to OverDrive’s documentation, the update is intended “to improve availability information and better support the sharing of copies between related accounts (consortia and member libraries [i.e., Advantage Accounts]). In order to support our partners currently using the availability API, we are releasing these changes on a new version of the Library Availability API endpoint (version 2).“

Version 2 of the API needs to be integrated with Evergreen so that copies of a title that have been purchased by member libraries through their OverDrive Advantage accounts are accounted for in the display of available copies. Currently, these copies are not represented in the total number of available copies.

Version 2 solves these problems.

Revision history for this message
Beth Willis (willis-a) wrote :

Related to the above bug report, if a title was purchased by a member library through their OverDrive Advantage account, but was not purchased by our consortium (NOBLE, Inc.), the catalog indicates that no copies are available. Note: in some cases the display indicates “status: null of null available” and in others “status: 0 of 0 available”. A screenshot is attached.

Revision history for this message
Beth Willis (willis-a) wrote :

Another example related to the bug report. If copies of a title have been purchased both by NOBLE, Inc. and by one or more libraries through their OverDrive Advantage accounts, the copies purchased by the libraries do not display in the catalog. A screenshot is attached. In this case, NOBLE owns a total of 11 copies of Nine Perfect Strangers; 8 purchased by the consortium and 3 through libraries' OverDrive Advantage accounts.

tags: added: overdrive
Changed in evergreen:
assignee: nobody → Martha Driscoll (mjdriscoll)
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Martha Driscoll (mjdriscoll) wrote :

OverDrive.pm sets a discovery_base_uri of 'https://api.overdrive.com/v1'. I added an 'availability_base_uri' set to 'https://api.overdrive.com/v2' and changed the functions that lookup holdings and availability to use the new base uri. Several other functions still require the v1 base uri.

Here is my commit:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/driscoll/lp1818144_overdrive_api_v2

Changed in evergreen:
assignee: Martha Driscoll (mjdriscoll) → nobody
tags: added: pullrequest
Michele Morgan (mmorgan)
Changed in evergreen:
milestone: none → 3.3.4
Changed in evergreen:
milestone: 3.3.4 → 3.3.5
Changed in evergreen:
milestone: 3.3.5 → 3.4.2
Changed in evergreen:
milestone: 3.4.2 → 3.4.3
Revision history for this message
Jason Stephenson (jstephenson) wrote :

Martha, thanks for the branch, but the code is incomplete. It is missing a database upgrade script to add the ebook_api.overdrive.availability_base_uri to the config.org_unit_setting_type table.

I'm removing the pullrequest tag and replacing it with needsrepatch.

CW MARS is interested in this as a part of working on bug 1861013.

tags: added: needsrepatch
removed: pullrequest
Revision history for this message
Martha Driscoll (mjdriscoll) wrote :
tags: added: pullrequest
removed: needsrepatch
Changed in evergreen:
milestone: 3.4.3 → 3.4.4
Changed in evergreen:
milestone: 3.4.4 → 3.5.1
Changed in evergreen:
milestone: 3.5.1 → 3.5.2
Revision history for this message
Jessica Woolford (jwoolford) wrote :

We tested this patch, and it seemed to work in testing so we applied it to our production system. We discovered that it works for OverDrive Advantage titles that were shared with the consortium, but if titles are not shared, they are still displaying as "null of null" or "0 of 0."

tags: added: needsrepatch
removed: pullrequest
Revision history for this message
Martha Driscoll (mjdriscoll) wrote :

Thanks for testing Jessica. I'll take another crack at it. We don't have Advantage titles that are not shared so I did not see this problem, but Overdrive has a testing environment so I'll look at that.

Changed in evergreen:
milestone: 3.5.2 → 3.6.1
Changed in evergreen:
milestone: 3.6.1 → 3.6.2
Changed in evergreen:
milestone: 3.6.2 → 3.6.3
Changed in evergreen:
milestone: 3.6.3 → none
tags: added: needswork
removed: needsrepatch
Revision history for this message
Martha Driscoll (mjdriscoll) wrote :

It would be helpful if someone with Advantage titles that are not shared with the consortium could post the JSON here. There is a tool in the support-scripts directory to query Overdrive: overdrive-api-checker.pl. the syntax is:

./overdrive-api-checker.pl --account {account ID} --verbose --token {basic token} --endpoint https://api.overdrive.com/v2/collections/{collection token}/products/{titleID}/availability

The account ID and basic token are in library settings. The title ID for the specific title is in the Marc 037 subfield a. The collection token can be found by querying the library collection API:

./overdrive-api-checker.pl --account {account ID} --verbose --token {basic token} --endpoint https://api.overdrive.com/v1/libraries/{account ID}

It would be helpful to see the V1 JSON as well:

./overdrive-api-checker.pl --account {account ID} --verbose --token {basic token} --endpoint https://api.overdrive.com/v1/collections/{collection code}/products/{titleID}/availability

Here is the JSON for a shared Advantage title:

{
    "accounts": [
        {
            "copiesAvailable": 1,
            "copiesOwned": 1,
            "id": 63,
            "shared": true
        },
        {
            "copiesAvailable": 1,
            "copiesOwned": 1,
            "id": -1
        }
    ],
    "availabilityType": "Normal",
    "available": true,
    "copiesAvailable": 2,
    "copiesOwned": 2,

Library 63 owns a copy that is shared and the consortium (id -1) also owns a copy.

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Here are the JSON responses I got for an Advantage title that isn't shared with the rest of the consortium:

./overdrive-api-checker.pl --account {account ID} --verbose --token "{basic token}" --endpoint https://api.overdrive.com/v2/collections/{Advantage collection token}/products/F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B/availability
{
  "reserveId": "F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B",
  "titleId": 9314012,
  "links": {
    "self": {
      "href": "https://api.overdrive.com/v2/collections/{Advantage collection token}/products/F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B/availability",
      "type": "application/vnd.overdrive.api+json"
    }
  },
  "accounts": [
    {
      "id": 121,
      "shared": false,
      "copiesOwned": 1,
      "copiesAvailable": 1
    }
  ],
  "available": true,
  "availabilityType": "Normal",
  "copiesOwned": 1,
  "copiesAvailable": 1,
  "numberOfHolds": 6
}

./overdrive-api-checker.pl --account {account ID} --verbose --token "{basic token}" --endpoint https://api.overdrive.com/v1/collections/{Advantage collection token}/products/F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B/availability
{
  "id": "F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B",
  "crossRefId": 9314012,
  "links": {
    "self": {
      "href": "https://api.overdrive.com/v1/collections/{Advantage collection token}/products/F2AF3EE4-044B-4A9A-A160-1FBF6F6EE25B/availability",
      "type": "application/vnd.overdrive.api+json"
    }
  },
  "collections": [
    {
      "id": "X Public Library",
      "copiesOwned": 1,
      "copiesAvailable": 1,
      "numberOfHolds": 0
    }
  ],
  "available": true,
  "availabilityType": "Normal",
  "copiesOwned": 1,
  "copiesAvailable": 1,
  "numberOfHolds": 6
}

Revision history for this message
Martha Driscoll (mjdriscoll) wrote :

I just want to capture something that Jeff said in IRC: when the query was done using the consortia's collection token a TitleNotFoundError was returned. Using the Advantage library's collection token was needed to obtain the availability data.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.