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

            Bug ID: 41185
           Summary: internal server error on all searches with REST API
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: 25.05
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: REST API
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]

Created attachment 189070
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189070&action=edit
patch

My environment:
Ubuntu Server 24.04 with latest updates
Koha 25.05 from packages
Basic authentication for REST API is enabled.

I run examples from official documentation
https://api.koha-community.org/#section/Filtering-responses

curl -u username:password --request GET "http://hostname/api/v1/patrons/";
--data-raw '{ "surname": "Acevedo", "firstname": "Henry" }'

curl -u username:password --request GET "http://hostname/api/v1/patrons/";
--data-raw '{ "surname": { "-like": "Ace%" }'

curl -u username:password --request GET "http://hostname/api/v1/patrons/";
--data-raw '{ "surname": [ "Acevedo", "Bernardo" ] }'

curl -u username:password --request GET 'http://hostname/api/v1/patrons/'
--header 'x-koha-embed: extended_attributes' --data-raw '{
"extended_attributes.code": "internet", "extended_attributes.attribute": "1" }'

They all return this:
{"error":"Something went wrong, check Koha logs for
details.","error_code":"internal_server_error"}

Error log:
[ERROR] GET /api/v1/patrons/: unhandled exception
(DBIx::Class::Exception)<<DBIx::Class::Storage::DBI::_dbh_execute(): DBI
Exception: DBD::mysql::st execute failed: Unknown column '{
"extended_attributes.code": "internet", "extended_attributes.attribute": "1" }'
in 'WHERE' at /usr/share/koha/lib/Koha/REST/Plugin/Objects.pm line 284>>

I turn on MariaDB query log and see what causes the error:
SELECT COUNT( * ) FROM `borrowers` `me` WHERE ( ( ( `firstname` = 'Henry' AND
`surname` = 'Acevedo' ) AND `{ "surname": "Acevedo", "firstname": "Henry" }`
LIKE '%%' ) )

I have developed a patch but this may require further investigation from Koha
developers why this is occurring in the first place.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to