Bug 24237 - The 406 response on the biblios end point should be more discoverable
Summary: The 406 response on the biblios end point should be more discoverable
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact:
URL:
Keywords:
: 24238 (view as bug list)
Depends on: 23677 24908
Blocks:
  Show dependency treegraph
 
Reported: 2019-12-13 12:19 UTC by Martin Renvoize
Modified: 2020-03-20 11:27 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2019-12-13 12:19:52 UTC
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.
Comment 1 Tomás Cohen Arazi 2020-03-18 18:31:41 UTC
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
Comment 2 Tomás Cohen Arazi 2020-03-18 18:33:15 UTC
*** Bug 24238 has been marked as a duplicate of this bug. ***
Comment 3 Tomás Cohen Arazi 2020-03-18 18:34:42 UTC
I am all for returning application/json as default, as suggested by Jonathan in 24238.