Bug 37032 - REST API: Unable to call item info via holds endpoint
Summary: REST API: Unable to call item info via holds endpoint
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Emmi Takkinen
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks: 36135
  Show dependency treegraph
 
Reported: 2024-06-05 05:43 UTC by Emmi Takkinen
Modified: 2024-08-21 17:15 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 37032: Fix typo in holds.yaml (967 bytes, patch)
2024-07-22 07:04 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 37032: Fix typo in holds.yaml (1013 bytes, patch)
2024-08-17 09:13 UTC, David Nind
Details | Diff | Splinter Review
Bug 37032: Fix typo in holds.yaml (1.05 KB, patch)
2024-08-21 08:15 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Emmi Takkinen 2024-06-05 05:43:32 UTC
I'm trying to fetch items barcode via holds endpoint with no luck. If I've understood correctly, this should be possible by adding item as embed in /api/v1/swagger/paths/holds.yaml and then adding it to enum option in kohaTable function. However this only leads to following error: 

>Something went wrong when loading the table.
>400: Bad Request. 
>Not in enum list: cancellation_requested, biblio, pickup_library, item.
Documentation for endpoint shows that endpoint should produce item object and Koha::Hold does have relation to item.
Comment 1 Emmi Takkinen 2024-07-19 09:49:46 UTC
It seems there is a typo in holds.yaml. Setting "collectionFormat: csv" is included inside "items" of "x-koha-embed". Fixing this allows me to add and call item as emded. However now some of my API calls fail on 500 error and Mojolicious compalains that "Not a HASH reference at /usr/share/perl5/SQL/Abstract/Classic.pm line 804".
Comment 2 Emmi Takkinen 2024-07-19 10:11:09 UTC
(In reply to Emmi Takkinen from comment #1)
> It seems there is a typo in holds.yaml. Setting "collectionFormat: csv" is
> included inside "items" of "x-koha-embed". Fixing this allows me to add and
> call item as emded. However now some of my API calls fail on 500 error and
> Mojolicious compalains that "Not a HASH reference at
> /usr/share/perl5/SQL/Abstract/Classic.pm line 804".

This doesn't seem to be related to emded problem.
Comment 3 Emmi Takkinen 2024-07-22 05:32:55 UTC
(In reply to Emmi Takkinen from comment #2)
> (In reply to Emmi Takkinen from comment #1)
> > It seems there is a typo in holds.yaml. Setting "collectionFormat: csv" is
> > included inside "items" of "x-koha-embed". Fixing this allows me to add and
> > call item as emded. However now some of my API calls fail on 500 error and
> > Mojolicious compalains that "Not a HASH reference at
> > /usr/share/perl5/SQL/Abstract/Classic.pm line 804".
> 
> This doesn't seem to be related to emded problem.

I mean, fixing this doesn't lead to 500 errors. Those are rather related how I'm building my table with API result. Fixing that typo allows using embed objects again.
Comment 4 Emmi Takkinen 2024-07-22 07:04:14 UTC
Created attachment 169266 [details] [review]
Bug 37032: Fix typo in holds.yaml

There is a typo in holds.yaml which prevents
fetching item as embeded object. Option
"collectionFormat" should be under "x-koha-embed",
not "items" array.

To test prove t/db_dependent/api/v1/holds.t.

Sponsored-by: Koha-Suomi Oy
Comment 5 Emmi Takkinen 2024-07-22 07:07:27 UTC
I'm unsure what's proper testing method for this (other than running tests for holds.t). Please feel free to point out what else should be tested and I will adjust test plan accordingly.
Comment 6 Emmi Takkinen 2024-08-08 05:31:46 UTC
Setting importance as normal since this prevents using endpoint with its full potential.
Comment 7 David Nind 2024-08-17 09:13:41 UTC
Created attachment 170463 [details] [review]
Bug 37032: Fix typo in holds.yaml

There is a typo in holds.yaml which prevents
fetching item as embeded object. Option
"collectionFormat" should be under "x-koha-embed",
not "items" array.

To test prove t/db_dependent/api/v1/holds.t.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Martin Renvoize 2024-08-21 08:15:58 UTC
Created attachment 170532 [details] [review]
Bug 37032: Fix typo in holds.yaml

There is a typo in holds.yaml which prevents
fetching item as embeded object. Option
"collectionFormat" should be under "x-koha-embed",
not "items" array.

To test prove t/db_dependent/api/v1/holds.t.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2024-08-21 08:16:14 UTC
Ooops, thanks Emmi
Comment 10 Katrin Fischer 2024-08-21 17:15:21 UTC
Pushed for 24.11!

Well done everyone, thank you!