Bug 41143 - Searching EBSCO packages results in 500 error due to Content-type
Summary: Searching EBSCO packages results in 500 error due to Content-type
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: ERM (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 33481
Blocks:
  Show dependency treegraph
 
Reported: 2025-10-30 14:48 UTC by Pedro Amorim
Modified: 2025-11-03 11:58 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41143: Do not include content-type header when searching packages (1.13 KB, patch)
2025-11-03 11:57 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2025-10-30 14:48:07 UTC

    
Comment 1 Pedro Amorim 2025-10-30 14:49:27 UTC
We started getting these errors when searching for packages in ERM eHoldings:

[2025/10/30 14:18:08] [WARN] ERROR - EBSCO API /packages?orderby=packagename&offset=1&count=1 returned 400 - The value 'application/json; charset=UTF-8' is not valid for the 'contenttype' parameter. Allowed values: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, all, aggregatedfulltext, abstractandindex, ebook, ejournal, print, unknown, onlinereference, streamingmedia, mixedcontent}.
[2025/10/30 14:18:08] [ERROR] GET /api/v1/erm/eholdings/ebsco/packages: unhandled exception (Mojo::Exception)<<ERROR requesting EBSCO API
/packages?orderby=packagename&offset=1&count=1
code 400: The value 'application/json; charset=UTF-8' is not valid for the 'contenttype' parameter. Allowed values: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, all, aggregatedfulltext, abstractandindex, ebook, ejournal, print, unknown, onlinereference, streamingmedia, mixedcontent}.>>

Reverting bug 33481 appears to prevent this from happening. But this looks weird, there seems to be something happening with contenttype vs content-type in the request.
Comment 2 Pedro Amorim 2025-10-30 15:12:46 UTC
Reverting bug 33481 appears to cause things to go wrong with selecting and deselecting titles and packages so a proper fix is required here.
Comment 3 Jonathan Druart 2025-11-03 11:47:39 UTC
The error does not mean anything, why are they using the content-type header as a parameter?

The doc:
https://developer.ebsco.com/knowledge-services/reference/findpackagesbynameusingget
there is indeed a contenttype parameter

I would contact them and ask what changed and if this behaviour is the expected one, maybe it's a bug on their side.
Comment 4 Jonathan Druart 2025-11-03 11:57:30 UTC
Created attachment 188926 [details] [review]
Bug 41143: Do not include content-type header when searching packages
Comment 5 Jonathan Druart 2025-11-03 11:58:28 UTC
This patch fixes the problem if you need a hotfix.