Bug 23864 - Viewing list of ILL requests gives 400 from the API
Summary: Viewing list of ILL requests gives 400 from the API
Status: RESOLVED DUPLICATE of bug 22522
Alias: None
Product: Koha
Classification: Unclassified
Component: ILL (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-22 08:05 UTC by Magnus Enger
Modified: 2019-10-24 07:21 UTC (History)
0 users

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 Magnus Enger 2019-10-22 08:05:56 UTC
On current master, when I try to view the list of ILL requests on <intranet>/cgi-bin/koha/ill/ill-requests.pl, the table is empty. 

JS Console says:

GET http://localhost:8081/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments,requested_partners 400 (Bad Request)

Plack error log says:

[2019-10-22 09:56:28.65973] [4790] [debug] [55fbc1aa] GET "/api/v1/illrequests"
[2019-10-22 09:56:28.66872] [4790] [debug] [55fbc1aa] Routing to controller "Koha::REST::V1::Auth" and action "under"
Use of uninitialized value $_[2] in hash element at /usr/local/share/perl/5.24.1/Mojolicious/Plugin/OpenAPI.pm line 275.
[2019-10-22 09:56:28.71873] [4790] [debug] [55fbc1aa] 400 Bad Request (0.058955s, 16.962/s)

Line 275 of /usr/local/share/perl/5.24.1/Mojolicious/Plugin/OpenAPI.pm looks like this:

sub _parameters_for { $_[0]->{parameters_for}{$_[2]}{lc($_[1])} || [] }

Plack access log says:

10.0.2.2 - - [22/Oct/2019:09:57:30 +0200] "GET /intranet/ill/ill-requests.pl HTTP/1.1" 200 38845 "http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
10.0.2.2 - - [22/Oct/2019:09:57:31 +0200] "GET /api/v1/app.pl/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments,requested_partners HTTP/1.1" 400 - "http://localhost:8081/cgi-bin/koha/ill/ill-requests.pl" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
10.0.2.2 - - [22/Oct/2019:09:57:31 +0200] "GET /intranet/errors/404.pl HTTP/1.1" 404 16726 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"

Could perhaps be a data problem, but I am pretty sure this used to work with the same data. 

I tried to apply the patches from bug 23529, but that did not fix things.
Comment 1 Magnus Enger 2019-10-22 08:17:35 UTC
The response to this:

GET <intranet>/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments,requested_partners

is actually this:

[{"message":"Malformed query string","path":"\/query\/embed"}]
Comment 2 Magnus Enger 2019-10-22 08:27:53 UTC
If I do a request like this:

GET <intranet>/api/v1/illrequests

I get a response with JSON data for all requests, as expected. If I add the "embed" parameter I get the error response reported in comment 2: 

GET <intranet>/api/v1/illrequests?embed=
GET <intranet>/api/v1/illrequests?embed=metadata
Comment 3 Magnus Enger 2019-10-24 07:21:11 UTC
Looks like a duplicate of 22522.

*** This bug has been marked as a duplicate of bug 22522 ***