[Bug 30790] New: Add REST API route to list biblios
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Bug ID: 30790 Summary: Add REST API route to list biblios Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: REST API Assignee: julian.maurice@biblibre.com Reporter: julian.maurice@biblibre.com CC: tomascohen@gmail.com Blocks: 17371 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17371 [Bug 17371] Add routes for biblios [OMNIBUS] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 135072 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135072&action=edit Bug 30790: Add REST API route to list biblios Examples: GET /api/v1/biblios GET /api/v1/biblios?q={"me.title": "foo"} GET /api/v1/biblios?q={"biblioitem.isbn": "1-23-456789-0"} GET /api/v1/biblios?_order_by=title Test plan: 1. Try requesting this endpoint with your favorite API tool 2. Run `prove t/db_dependent/api/v1/biblios/list.t` -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- We have hidden the biblioitem table from the API. I regret not having spent time on a more generic solution yet... Take a look at... Orders.pm when it comes to filtering by biblio.* -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Tomás Cohen Arazi from comment #2)
We have hidden the biblioitem table from the API. I regret not having spent time on a more generic solution yet...
Take a look at... Orders.pm when it comes to filtering by biblio.*
It looks like Koha/REST/Plugin/Objects.pm was duplicated inside Koha::REST::V1::Orders::list ... is it what we are supposed to do ? :/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Julian Maurice from comment #3)
(In reply to Tomás Cohen Arazi from comment #2)
We have hidden the biblioitem table from the API. I regret not having spent time on a more generic solution yet...
Take a look at... Orders.pm when it comes to filtering by biblio.*
It looks like Koha/REST/Plugin/Objects.pm was duplicated inside Koha::REST::V1::Orders::list ... is it what we are supposed to do ? :/
No, that's why I say I regret not finding the time to provide a generic solution... Namely, a pair of Koha::Objects methods for tweaking the 'embed' structure and queries.... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #5 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Tomás Cohen Arazi from comment #4)
No, that's why I say I regret not finding the time to provide a generic solution... Namely, a pair of Koha::Objects methods for tweaking the 'embed' structure and queries....
I just noticed that I can do GET /api/v1/biblios?q={"isbn": "1-23-456789-0"} without the "biblioitem." prefix and it works too. So... is there something else needed ? (except updating the tests and commit messages to reflect that) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135072|0 |1 is obsolete| | --- Comment #6 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 135089 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135089&action=edit Bug 30790: Add REST API route to list biblios Examples: GET /api/v1/biblios GET /api/v1/biblios?q={"title": "foo"} GET /api/v1/biblios?q={"isbn": "1-23-456789-0"} GET /api/v1/biblios?_order_by=title Test plan: 1. Try requesting this endpoint with your favorite API tool 2. Run `prove t/db_dependent/api/v1/biblios/list.t` -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135089|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 135199 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135199&action=edit Bug 30790: Add REST API route to list biblios Examples: GET /api/v1/biblios GET /api/v1/biblios?q={"title": "foo"} GET /api/v1/biblios?q={"isbn": "1-23-456789-0"} GET /api/v1/biblios?_order_by=title Test plan: 1. Try requesting this endpoint with your favorite API tool 2. Run `prove t/db_dependent/api/v1/biblios/list.t` Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- + $schema->resultset('Biblio')->delete(); Hmm -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- my $biblios_rs = Koha::Biblios->new->search(undef, { join => 'biblioitem' }); Not a normal pattern to use new here -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |ASSIGNED --- Comment #10 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Marcel de Rooy from comment #8)
+ $schema->resultset('Biblio')->delete();
Hmm
What is wrong with this ? It's in the tests, inside a transaction. (In reply to Marcel de Rooy from comment #9)
my $biblios_rs = Koha::Biblios->new->search(undef, { join => 'biblioitem' });
Not a normal pattern to use new here
Bad copy/paste/edit here ... I'll fix it -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Julian Maurice from comment #10)
(In reply to Marcel de Rooy from comment #8)
+ $schema->resultset('Biblio')->delete(); What is wrong with this ? It's in the tests, inside a transaction.
We try to avoid direct DBIx stuff when having an Koha object. Yes, this may be faster. But Koha objects abstract the DBIx. So here you could simply do Koha::Biblios->delete. Like: t/db_dependent/HoldsQueue.t: Koha::Biblios->delete(); But found: t/db_dependent/Koha/BiblioUtils/Iterator.t:$schema->resultset('Biblio')->delete(); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Just trying to get a bit more grip on what could be done with the query string: objects.search my $args = $c->validation->output; [..] my ( $filtered_params, $reserved_params, $path_params ) = $c->extract_reserved_params($args); Query extract_reserved_params $c->req->params->to_hash is compared with $c->validation->output The first iiuc is all get/post parameters. But what exactly is the second? Where is this output method exactly? Thus far couldnt find it yet in the JSON Validator and OpenAPI stuff.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Seeing this too: # Failed test 'No tests run for subtest "get() tests"' # at t/db_dependent/api/v1/biblios/list.t line 89. DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_myclone`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at t/db_dependent/api/v1/biblios/list.t line 48 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Marcel de Rooy from comment #13)
Seeing this too:
# Failed test 'No tests run for subtest "get() tests"' # at t/db_dependent/api/v1/biblios/list.t line 89. DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_myclone`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at t/db_dependent/api/v1/biblios/list.t line 48
Yes, when you delete biblios there could still be issues ! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Marcel de Rooy from comment #14)
(In reply to Marcel de Rooy from comment #13)
Seeing this too:
# Failed test 'No tests run for subtest "get() tests"' # at t/db_dependent/api/v1/biblios/list.t line 89. DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_myclone`.`issues`, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON UPDATE CASCADE) at t/db_dependent/api/v1/biblios/list.t line 48
Yes, when you delete biblios there could still be issues !
You might better consider adding a few biblios without deleting them all btw. And adjusting your queries based on that situation? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |27113 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27113 [Bug 27113] Elasticsearch: Autocomplete in search -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com, | |hammat.wele@inlibro.com, | |philippe.blouin@inlibro.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |DUPLICATE --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Picking bug 32734 which includes more use cases (response formats based on the Accept header) and is pretty similar and active. *** This bug has been marked as a duplicate of bug 32734 *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30790 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|17371, 27113 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17371 [Bug 17371] Add routes for biblios [OMNIBUS] https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27113 [Bug 27113] Elasticsearch: Autocomplete in search -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org