[Bug 40970] New: REST API: Searching /biblios with JSON 'q' parameter fails with SQL error
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40970 Bug ID: 40970 Summary: REST API: Searching /biblios with JSON 'q' parameter fails with SQL error Change sponsored?: --- Product: Koha Version: 25.05 Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: adrianphilip.luna@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com I was checking out the KOHA REST API and I tried using the query parameters in /api/v1/biblios by: 1. Authenticate to the REST API. 2. Send a GET request to /api/v1/biblios with a JSON query parameter like q=[["title", "like", "%Abstract%"]]. This results in a 500 server error: HTTP error: 500 Server Error: Internal Server Error for url: api/v1/biblios?_page=1&_per_page=5&q=%5B%5B%22title%22%2C+%22like%22%2C+%22%25Abstract%25%22%5D%5D Response: {"errors":[{"message":"Internal Server Error.","path":"\/"}],"status":500} Looking at the api error logs I have these: [2025/10/08 10:21:38] [ERROR] 'true' expected, at character offset 0 (before "title:python") at /usr/share/koha/lib/Koha/REST/Plugin/Objects.pm line 242. Mojolicious::Plugin::DefaultHelpers::_development /usr/share/perl5/Mojolicious/Plugin/DefaultHelpers.pm (94) [2025/10/08 10:23:19] [ERROR] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'q' in 'where clause' at /usr/share/perl5/Data/Page.pm line 49 Mojolicious::Plugin::DefaultHelpers::_development /usr/share/perl5/Mojolicious/Plugin/DefaultHelpers.pm (94) [2025/10/08 10:29:34] [ERROR] 'true' expected, at character offset 0 (before "title:Abstract") at /usr/share/koha/lib/Koha/REST/Plugin/Objects.pm line 242. Mojolicious::Plugin::DefaultHelpers::_development /usr/share/perl5/Mojolicious/Plugin/DefaultHelpers.pm (94) [2025/10/08 10:42:07] [ERROR] 'true' expected, at character offset 0 (before "title:Abstract") at /usr/share/koha/lib/Koha/REST/Plugin/Objects.pm line 242. Mojolicious::Plugin::DefaultHelpers::_development /usr/share/perl5/Mojolicious/Plugin/DefaultHelpers.pm (94) [2025/10/08 10:46:25] [ERROR] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column '%Abstract%' in 'where clause' at /usr/share/perl5/Data/Page.pm line 49 Mojolicious::Plugin::DefaultHelpers::_development /usr/share/perl5/Mojolicious/Plugin/DefaultHelpers.pm (94) I could use the other parameters like _page and _per_page but when I use q it just crashes. Any help would be nice. -- 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=40970 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- The correct syntax is: q=[{"title":{"like":"%Abstract%"}}] -- 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=40970 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |CLOSED --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- You will find more info there https://api.koha-community.org/ -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org