https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43592

--- Comment #2 from Amit Gupta <[email protected]> ---
Created attachment 206500
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206500&action=edit
Bug 43592: Google Books OPAC suggestion autofill fails with  quota error due to
missing API key and query format

Querying the Google Books API without an API key using the endpoint format
'https://www.googleapis.com/books/v1/volumes?q=<isbn>' triggers 429
quota errors because unauthenticated IP-based requests are heavily throttled.
Additionally, omitting the 'isbn:' search qualifier can fail to return exact
ISBN matches.

This patch updates autofill.js
1. Explicitly prepend 'isbn:' to the query string (q=isbn:<clean_isbn>).
2. Pass the 'GoogleBooksApiKey' system preference to append '&key=<apiKey>'.
3. Clean and sanitize ISBN input values.

Test Plan:

1. Log in to the Koha Staff Interface as an administrator.
2. Go to Administration -> System preferences and enable
OPACSuggestionAutoFill.
3. Log in to the OPAC and go to the Purchase Suggestion page
(opac-suggestions.pl?op=add).
4. Enter a valid ISBN (e.g., 9781492180746) in the ISBN field and click "Search
Google Books".
5. No result populates
6. Apply the patch.
7. Go to Administration -> System preferences in the Staff Interface.
8. Search for GoogleBooksApiKey and enter a valid Google Books API key.
9. Return to the OPAC Purchase Suggestion page, enter the ISBN, and click
"Search Google Books".
10. Verify that the book details (Title, Author, Publisher) populate correctly
into the form.


Added new System preference: GoogleBooksApiKey

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to