← Previous day | Today | Next day → | Search | Index
All times shown according to UTC.
Time | Nick | Message |
---|---|---|
00:24 | steve joined #koha | |
00:24 | steve | Hi! |
00:25 | Is someone here familiar with using the REST API? | |
00:26 | Guest1449 | I'm trying to get the curl API examples to work, but all I get is a 500 error |
00:30 | mtj | hi steve, Guest1449, https://wiki.koha-community.or[…]ki/REST_API_Debug |
00:30 | try section 1.1 ^ | |
00:32 | Guest1449 | This works. Some simple requests also work. But the examples using curl from the Koha wiki give me an error. |
00:33 | This does not work: curl -u kohaapi:kohaapi --request GET "http://koha_testing/api/v1/patrons/" --data-raw "{ "surname": { "-like": "Smith%" }" | |
00:33 | The api returns {"error":"Something went wrong, check Koha logs for details.","error_code":"internal_server_error"} | |
00:34 | In the koha api-error.log it says [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 '{ surname: { -like: Smith% }' in 'where clause' at /usr/share/perl5/Data/Page.pm line 49>> Koha::REST::Plugin::Exceptions::__ANON__ /usr/share/koha/lib/Koha/REST/Plugin/Exceptions.pm (73) | |
00:37 | Simple requests that do not use any JSON parameters work (i.e. /api/v1/items/42) | |
00:39 | Which is weird since the error looks like a database problem, as if the JSON is directly embedded into an SQL query | |
00:41 | mtj | Guest1449: do you have any perl packages installed via CPAN? |
00:43 | Guest1449: are you using plack? | |
00:43 | ..and what koha version? | |
00:47 | Guest1449 | Koha 22.05, installed via the Debian package on a newly installed system. So there shouldn't be any extra packages. |
01:00 | mtj | hmm, works for me Guest1449 |
01:01 | my guess is that the 'user' you are authing with, does not have enough privs | |
01:01 | try creating/using a 'superuser' user | |
01:03 | RESTBasicAuth syspref = on | |
01:03 | https://wiki.koha-community.or[…]T_API_Users_Guide | |
01:04 | curl -s -u admin:xxxx --request GET http://mykoha.net/api/v1/patrons --data-raw '{ "surname": { "-like": "admi%" } }' | |
01:05 | works for me on koha-21.05.18 | |
01:12 | Guest1449: any luck? | |
01:13 | what OS are you running? | |
01:13 | Guest1449 | I'm trying right now, just a moment |
01:13 | Debian 11 Bullseye | |
01:16 | mtj | Guest1449: and do you have a database created, for this instance? |
01:17 | ..either by running the web-install step, or loading in an old db? | |
01:17 | Guest1449 | Same error as before |
01:18 | mtj | you might want to confirm that you have a borrowers table, with a surname column |
01:19 | Guest1449 | I used the Koha installer, it created the database as part of the installation process. |
01:21 | The surname column is there, SELECT surname FROM borrowers does work | |
01:22 | I just used the example from the Koha wiki. None of the API queries seem to work if they involve sending parameters as JSON | |
01:24 | mtj | Guest1449: 1 tic.. let me test 22.05 |
01:28 | Guest1449 | I got it working now |
01:29 | Koha wants a Content-Type header | |
01:29 | curl -v -s -u kohaapi2:kohaapi --header "Content-Type: application/json" --request GET http://koha_testing/api/v1/patrons --data-raw '{ "surname": { "-like": "Smith%" } }' | |
01:31 | mtj | hmm, works without a --header arg, for me |
01:31 | bone joined #koha | |
01:34 | Guest1449 | strange, if I don't include the header, it fails in that weird way I described before. |
01:34 | It doesn't appear to matter what the header actually is as long as it is there. | |
01:37 | mtj | hmm, perhaps you have some records that have tricky data, that the header arg fixes |
01:38 | or you might be accessing system via an http proxy/cache that needs the header? | |
01:39 | Guest1449: congrats on finding a fix, perhaps we need to update the doco/wiki | |
01:40 | Guest1449 | I don't think it can have anthing to do with the records, since the problem appears with all API queries as long as they send JSON. Even things that don't have anything to do with records. |
01:41 | It can't be a cache/proxy unless it comes in the default koha installation somehow. I have not installed anything else. | |
01:41 | mtj | ok |
01:42 | you are running curl on same system as koha? | |
01:43 | Guest1449 | Yes, and I've also tried with a differnt machine. |
01:47 | I'm trying to find the code that actually parses the headers sent by a client. | |
01:49 | What puzzles me is how the request sent by a client can end up as a column name in a database query if that header is missing. At least that is what the entry in the log file looked like. | |
02:04 | mtj | Guest1449: i think plack probably parses the headers first |
02:04 | https://metacpan.org/pod/Plack | |
02:05 | via https://metacpan.org/pod/HTTP::Headers::Fast | |
02:13 | hmm, upgraing to deb11 may require --header "Content-Type: application/json" | |
02:18 | Guest1449 | I just tested it with a public koha instance running Koha 22.11 and the issue appears there as well |
02:21 | mtj | hmm, looks like the --header requirement is introduced with deb11, via some other package |
02:22 | a newer version of a pkg in deb11 | |
02:39 | Guest1449 | The error seems to be caused by sending Content-type: application/x-www-form-urlencoded |
02:41 | curl does this if no header is specified, not sending a header deliberately by using --header "Content-type:" will not cause an issue | |
02:46 | mtj | aah, problem is not introduced by deb11 |
02:46 | ..looks like its a koha problem, introduced between 21.05 and 22.05 | |
02:58 | hmm, introduced in 22.05 | |
03:00 | Guest1449 | Should I file a bug? |
03:01 | It might be related to Bug 29595, but there the returned data is wrong as opposed to a failure due to a DB error. | |
03:01 | huginn | 04Bug https://bugs.koha-community.or[…]_bug.cgi?id=29595 trivial, P5 - low, ---, koha-bugs, NEW , missing Content-Type / HTTP 415 check for POST requests to /api/v1/patrons |
03:13 | mtj | behaviour exists in 22.05.00 |
03:15 | Guest1449 | I looks like using that header causes Koha to treat the all user supplied data as a column name in the borrowers table for some odd reason |
03:16 | curl -v -s -u kohaapi:kohaapi --request GET http://koha_testing/api/v1/patrons --data-raw 'firstname' will not cause an error, because a column named firstname exists in the borrowers table | |
03:26 | mtj | Guest1449: i think its worth logging a bug, cut/pasting the chat into it |
03:26 | Guest1449 | Okay, I will write one |
03:27 | It also works for /api/v1/items if a column name from the items table is specified. | |
03:31 | But only with Koha 22.05 | |
03:46 | mtj | looking at the 29595 bug report - it seems that the new 22.05 behaviour is more 'correct', and the doco needs to be updated |
03:49 | koha only accepts the request as json, unless we explicily tell it too | |
03:50 | s/unless/if/ | |
04:02 | i updated the wiki https://wiki.koha-community.or[…]T_API_Users_Guide | |
04:17 | Guest1449 | I've created Bug 32637 |
04:17 | huginn | 04Bug https://bugs.koha-community.or[…]_bug.cgi?id=32637 normal, P5 - low, ---, koha-bugs, NEW , API requests using Content-Type: application/x-www-form-urlencoded fail, user data treated as DB column name |
04:22 | Guest1449 | mtj, thanks for the help! |
04:54 | paxed | uhh, is "Trident Support Team" supposed to spam my email? |
07:04 | alex_ joined #koha | |
07:05 | alex_ | Bonjour |
07:05 | wahanui | hello, alex_ |
07:17 | reiveune joined #koha | |
07:17 | reiveune | hello |
07:17 | wahanui | hi, reiveune |
07:31 | magnuse joined #koha | |
07:36 | magnuse | \o/ |
07:51 | semarie joined #koha | |
07:53 | semarie | hi. koha-devel@ list is currently spammed with "[Koha-devel] New request created with ID: ##XXXXXX## from koha-devel-requestlists.koha-community.org" |
07:54 | I received 471 differents mails since Sun, 15 Jan 2023 20:56:31 +0000 | |
07:54 | thibaud_g joined #koha | |
07:55 | semarie | see https://lists.koha-community.o[…]January/date.html |
08:03 | cait joined #koha | |
08:05 | cait | someone from Biblibre around? |
08:07 | and good morning #koha | |
08:07 | was the mailing list spammer stopped already? | |
08:45 | magnuse_ joined #koha | |
08:53 | magnuse__ joined #koha | |
09:03 | magnuse_ joined #koha | |
09:06 | magnuse__ joined #koha | |
09:15 | paulderscheid[m] | Yes, they stopped it this morning. |
09:17 | ashimema | mornign |
10:43 | magnuse | has anynoe been able to teach zebra to to treat characters with and without umlauts as separate characters? so a search for "tur" and "tür" does not give the same results? or is the answer to that just "elasticsearch"? cait? |
10:47 | paxed | i think sort-string.chr at least had something to do with it |
10:48 | sort-string-utf.chr | |
10:50 | magnuse | i have tried to tweak that, but it does not seem to work... |
10:51 | cait | magnuse: we actually want that behaviour |
10:51 | we also taught it that ue = ü = u | |
10:52 | but in theory you just need to remove the mapping I think from he file paxed said | |
10:52 | magnuse | cait: i am shocked! |
10:52 | ;-) | |
10:52 | yeah, in theory :-) | |
10:52 | cait | ue is a common way to write umlauts when diacritics are not available or in old data |
10:53 | we also have some ß = ss rule | |
10:53 | paxed | pfft. you germans and your strange letter subsitutions |
10:53 | ashimema | Joubu around? |
10:53 | any idea why master is failing at the moment? | |
10:54 | cait | magnuse: I think you want to change etc/zebradb/etc/word-phrase-utf.chr |
10:55 | paxed | yeah, that's the one ^ |
10:55 | magnuse | abd that is a "global" file, not a site specific one? |
10:56 | or language specific ,i mean | |
10:56 | /etc/koha/zebradb/etc/word-phrase-utf.chr | |
10:56 | vs /etc/koha/zebradb/lang_defs/nb/sort-string-utf.chr | |
10:58 | paxed | both seem to contain the same types of statements, so maybe the language specific one? |
10:59 | but it's been a while; we moved to es a while back when updating to newer koha | |
11:02 | magnuse | probably a good idea... |
11:03 | i wonder if the order of directories given for profilePath is significant | |
11:04 | cait | hm I hve achanged that one and t seems to work |
11:04 | I grapped the path of a patch, but it's an old one | |
11:04 | I think you can have some site specific configuration files actually | |
11:04 | we never used it, we like to have some standardization :) | |
12:11 | magnuse | cait: of course you do ;-) |
12:12 | and yes, /etc/koha/sites/<name> is the first path in profilePath | |
12:22 | alex_ joined #koha | |
12:25 | magnuse_ joined #koha | |
12:51 | alex__ joined #koha | |
13:45 | alex_ joined #koha | |
14:05 | caroline joined #koha | |
14:33 | tundunf joined #koha | |
14:33 | tundunf | hi all :) |
14:45 | magnuse__ joined #koha | |
15:08 | caroline | did anyone ever have this problem https://snipboard.io/gau2fR.jpg when the cover image is short, the loading spinner never disappears |
15:09 | does this mean that the spinner is always there, but just hidden by the cover image? | |
15:20 | ok found bug 28314 about this... I'll add a detailed test plan | |
15:21 | huginn | 04Bug https://bugs.koha-community.or[…]_bug.cgi?id=28314 minor, P5 - low, ---, koha-bugs, NEW , Spinning icon is not always going away for local covers in staff |
15:53 | alex_ joined #koha | |
16:19 | cait left #koha | |
16:45 | reiveune | bye |
16:45 | reiveune left #koha | |
16:57 | fridolin joined #koha | |
16:57 | fridolin | yellow |
19:34 | fridolin joined #koha | |
22:46 | tuxayo | davidnind: I might have ask before but I can't find it: who else has access to the calendar? So I can note it here: https://wiki.koha-community.or[…]on#koha-community.org.2Fcalendar |
22:46 | From what I found there is at least you, Martin and Tomás. | |
22:48 | davidnind | Also Joubu and I think fridolin may as well, also people from koha-US for adding SIG and koha-US meetings |
22:50 | dcook joined #koha | |
22:54 | davidnind | tuxayo: this list is out of date (as mentioned) https://wiki.koha-community.or[…]on#koha-community.org.2Fcalendar |
23:46 | cait[m] | davidnind: I think i found the fix for the broken so on ktd - maybe you want to try it, just one character to add :) |
23:47 | davidnind | thanks cait! I am going to try shortly with some testing (after I have lunch) |
23:47 | cait++ | |
23:48 | cait[m] | lunch first :) |
23:48 | I had a hunch what it could be and I hope it will work for you as well | |
23:49 | davidnind | looking forward to trying it... |
← Previous day | Today | Next day → | Search | Index