internetarchive / internetarchive/openlibrary

API responses is not a generic model

Open
#3,612 1 comment 0 reactions 0 assignees View on GitHub
Lead: @mekarpeles Priority: 3 Theme: Public APIs Type: Feature Request
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### 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

* Actual:
The problem is that he response returns a highly specific object. In the example above the object returned is ISBN:9781741795226 with multiple also very specific objects encased within it. This creates an issue for systems expecting generic attribute names.

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"
]
},

* Expected:
The return of generic objects, e.g.

"ISBN_Record": {
"publishers": [
{
"name": "Lonely Planet"
}
],
"pagination": "286 p. :",
"identifiers": {
"type":"isbn_13",
"code":"9781741795226",
"type":"lccn",
"code":"2009455714"
},
### Details

- **Logged in (Y/N)?** N
- **Browser type/version?** N/A
- **Operating system?** N/A
- **Environment (prod/dev/local)?** prod

### Proposal & Constraints

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

### Related files

### Stakeholders

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.