curl -X GET "https://api.example.com/api/v1/books/isbn/978-0-618-00222-1" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{ "isbn": "978-0-618-00222-1", "title": "The Lord of the Rings", "subtitle": "The Fellowship of the Ring", "publishers": ["Allen & Unwin", "Houghton Mifflin"], "publishDate": "1954", "numberOfPages": 423, "authors": ["J.R.R. Tolkien"]}
Books
Search Book by ISBN
Searches for a book by its ISBN. First checks the local database, and if not found, queries the OpenLibrary external API. If found externally, the book is automatically saved to the local database.
GET
/
api
/
v1
/
books
/
isbn
/
{isbn}
curl -X GET "https://api.example.com/api/v1/books/isbn/978-0-618-00222-1" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{ "isbn": "978-0-618-00222-1", "title": "The Lord of the Rings", "subtitle": "The Fellowship of the Ring", "publishers": ["Allen & Unwin", "Houghton Mifflin"], "publishDate": "1954", "numberOfPages": 423, "authors": ["J.R.R. Tolkien"]}
curl -X GET "https://api.example.com/api/v1/books/isbn/978-0-618-00222-1" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{ "isbn": "978-0-618-00222-1", "title": "The Lord of the Rings", "subtitle": "The Fellowship of the Ring", "publishers": ["Allen & Unwin", "Houghton Mifflin"], "publishDate": "1954", "numberOfPages": 423, "authors": ["J.R.R. Tolkien"]}
This endpoint integrates with the OpenLibrary API to fetch book information when a book is not found in the local database. The integration workflow is:
Local Database Check: First searches the local database for the ISBN
External API Query: If not found locally, queries OpenLibrary API
Auto-Save: If found externally, the book is automatically saved to the local database
Response Status: Returns 200 OK for existing books, 201 Created for newly added books from OpenLibrary