[Bug 24237] New: The 406 response on the biblios end point should be more discoverable
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Bug ID: 24237 Summary: The 406 response on the biblios end point should be more discoverable Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@ptfs-europe.com Other endpoints default to an application/json response by default regardless of the Accept headers in the request. For consistency, we should do the same on the biblios endpoint.. I'm thinking a 406 still, but with a JSON encoded error message in the body explaining the available Accept headers. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Currently, if you don't specify any Accept header you get a 406, and the following response body (application/json): [ "application/json", "application/marcxml+xml", "application/marc-in-json", "application/marc" ] I followed what is described here on the Mozilla site [1]. Now that I re-read it they suggest the site usually just skips the error and returns a fallback (the default response). It then mentions if you want to return 406, give the consumer a list of accept-able mime types. I am open to any change. Let's discuss it in more detail. [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- *** Bug 24238 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I am all for returning application/json as default, as suggested by Jonathan in 24238. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23677 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23677 [Bug 23677] Add API route to get a bibliographic record -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24908 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24908 [Bug 24908] Allow fetching text-formatted MARC data -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Bug 24237 depends on bug 24908, which changed state. Bug 24908 Summary: Allow fetching text-formatted MARC data https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24908 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |tomascohen@gmail.com --- Comment #4 from Lisette Scheer <lisette@bywatersolutions.com> --- Setting empty QA contacts to Default. Some searches don't handle empty QA contact fields well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 --- Comment #5 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 207288 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207288&action=edit Bug 24237: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 207289 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207289&action=edit Bug 24237: Make record returning endpoints have a fallback format Right now, the following endpoints return a 406 with a list of valid formats whenever an `Accept` header doesn't match the accepted formats, or if it is absent: * GET /authorities * GET /authorities/:authority_id * GET /biblios * GET /biblios/:biblio_id * GET /deleted/biblios * GET /deleted/biblios/:deleted_biblio_id It's been asked to fallback to `application/json` when the `Accept` header is not present, to have a sane default instead of an error. This patch implements that. The 406 is kept for invalid `Accept` headers. To test: 1. Launch a KTD instance: $ ktd --proxy --name bug_24237 up -d 2. Apply the regression tests patch 3. Run the tests: $ ktd --name bug_24237 --shell k$ prove t/db_dependent/api/v1/authorities.t \ t/db_dependent/api/v1/biblios.t \ t/db_dependent/api/v1/deleted_biblios.t => FAIL: New behavior tested, they don't pass. 406 returned instead of falling back to a known format. 4. Apply this patch 5. Repeat 3 => SUCCESS: Tests pass! 6. Test using postman and various `Accept` headers => SUCCESS: Works as expected! 7. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 --- Comment #7 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 207290 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207290&action=edit Bug 24237: Update the spec -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|tomascohen@gmail.com |jonathan.druart@gmail.com Summary|The 406 response on the |Fallback to |biblios end point should be |`application/json` when no |more discoverable |Accept header passed on | |record(s) endpoints -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207290|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24237 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 207296 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207296&action=edit Bug 24237: Update the spec -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org