internetarchive / openlibrary

One webpage for every book ever published!
https://openlibrary.org
GNU Affero General Public License v3.0
5.11k stars 1.34k forks source link

API responses is not a generic model #3612

Open GitWonder opened 4 years ago

GitWonder commented 4 years ago

Evidence / Screenshot (if possible)

Relevant url?

Steps to Reproduce

  1. Call https://openlibrary.org/api/books?bibkeys=ISBN:9781741795226&jscmd=data&format=json
  2. Read Response

What is returned is highly specific data that does not lend itself to generic modelling at the receiving end. { "ISBN:9781741795226": { This is an object called ISBN:9781741795226 as opposed to instance number 9781741795226 of ISBN object. "publishers": [
{ "name": "Lonely Planet" } ], "pagination": "286 p. :", "identifiers": { "isbn_13": [ "9781741795226" ], "lccn": [ "2009455714" ], "openlibrary": [ "OL23996497M" ], "isbn_10": [ "1741795222" ] },

Proposal & Constraints

Make the response fields more generic as this allows for easier modelling at the receiving end

Related files

Stakeholders

GitWonder commented 3 years ago

Looking at the first element of the REST return "ISBN:9781741795226":

It looks like it is actually a bug that has omitted the quote marks round the : which has turned a the label into part of the object and made it ungeneric