[Bug 17007] New: REST API: add route to get biblio
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Bug ID: 17007 Summary: REST API: add route to get biblio Change sponsored?: Sponsored Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P3 Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: mail@jkozlovsky.cz QA Contact: testopia@bugs.koha-community.org CC: black23@gmail.com, josef.moravec@gmail.com Blocks: 16652 Add API route for getting an biblio GET /api/v1/biblios/{biblionumber} Gets one Biblio Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16652 [Bug 16652] Omnibus: RestfulAPI supporting services for Vufind and for xnciptoolkit drivers -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiří Kozlovský <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 --- Comment #1 from Jiří Kozlovský <mail@jkozlovsky.cz> --- Created attachment 53823 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53823&action=edit Bug 17007: REST API: add route to get biblio This patch adds route to get one biblio from koha.biblios table. On top of this biblio there is added key "items" with value being array of items belonging to the requested biblio. To test: 1. Open a browser tab on Koha staff and log in (to create CGISESSID cookie). 2. Send GET request to http://yourlibrary/api/v1/biblios/YYY where YYY is an existing biblionumber. 3. Make sure the returned data is correct. 4. Run unit tests in t/db_dependent/api/v1/biblios.t -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiří Kozlovský <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53823|0 |1 is obsolete| | --- Comment #2 from Jiří Kozlovský <mail@jkozlovsky.cz> --- Created attachment 53824 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53824&action=edit Bug 17007: REST API: add route to get biblio Since there could be performance problems with retrieving all the details from all the items belonging to an biblio, there is now returned only a list of itemnumbers within an "items" key instead of all the item's properties. To obtain specific item's properties, use the provided itemnumber to query REST API for items done by Lari Taskula in bug 16825 To test: 1. Open a browser tab on Koha staff and log in (to create CGISESSID cookie). 2. Send GET request to http://yourlibrary/api/v1/biblios/YYY where YYY is an existing biblionumber. 3. Make sure the returned data is correct. 4. Run unit tests in t/db_dependent/api/v1/biblios.t -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiří Kozlovský <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53824|0 |1 is obsolete| | --- Comment #3 from Jiří Kozlovský <mail@jkozlovsky.cz> --- Created attachment 53825 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53825&action=edit Bug 17007: REST API: add route to get biblio -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@libriotech.no --- Comment #4 from Magnus Enger <magnus@libriotech.no> --- Does this respect records that are hidden in the OPAC? http://manual.koha-community.org/16.05/en/administration.html#OpacHiddenItem... -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 --- Comment #5 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- (In reply to Magnus Enger from comment #4)
Does this respect records that are hidden in the OPAC? http://manual.koha-community.org/16.05/en/administration.html#OpacHiddenItem...
Good catch! It doesn't respect the OpacHiddenItems syspref. The reason is that Koha::Biblio object class doesn't respect it also. It performs a search in DB given only the biblionumber. I think we should file a new bug for this in order to preserve single responsibility. Btw there are some bugs creating new REST API for items, which should respect the OpacHiddenItems, but again, to preserve the single responsibility statement it should be handled from within the middleware - Koha::Items etc. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion --- Comment #6 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- (In reply to Jiri Kozlovsky from comment #5)
(In reply to Magnus Enger from comment #4)
Does this respect records that are hidden in the OPAC? http://manual.koha-community.org/16.05/en/administration.html#OpacHiddenItem... I think we should file a new bug for this in order to preserve single responsibility.
After thinking this through, I've came up with the idea, that Koha::Biblio's single responsibility is to just retrieve biblios from the DB. So the solution should probably be in the Koha::REST::V1::Biblios, which this patch creates. After all, even though API is not OPAC & the syspref is described as "Define custom rules to hide specific items from search and view on the OPAC. How to write these rules is documented on the Koha wiki.", I agree with the idea it should be hidden from borrowers, but not from staff. This is why I'm going to implement showing OpacHiddenItems only to staff. Changing the status to In Discussion. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |larit@student.uef.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53825|0 |1 is obsolete| | --- Comment #7 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- Created attachment 53834 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53834&action=edit Bug 17007: REST API: add route to get biblio As Magnus Enger pointed out, we should hide all the items defined in the OpacHiddenItems syspref from all but staff. This patch adds this functionality. To test: 1. Open a browser tab on Koha staff and log in (to create CGISESSID cookie). 2. Send GET request to http://yourlibrary/api/v1/biblios/YYY where YYY is an existing biblionumber. 3. Make sure the returned data is correct. 4. Find items which are hidden in OPAC with OpacHiddenItems syspref, note their record's biblionumber and repeat point 2 with it. 5. Check that if you are logged in as staff, you see all the items (even those hidden from OPAC) 6. Check that if you are not logged in as staff, you see only the items which are not hidden from OPAC 7. Run unit tests in t/db_dependent/api/v1/biblios.t -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53834|0 |1 is obsolete| | --- Comment #8 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- Created attachment 53836 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53836&action=edit Bug 17007: REST API: add route to get biblio Fixed error when user is not staff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |mail@jkozlovsky.cz |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Lari Taskula <larit@student.uef.fi> 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=17007 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53836|0 |1 is obsolete| | --- Comment #9 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54187 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54187&action=edit Bug 17007: REST API: add route to get biblio This patch adds route to get one biblio from koha.biblios table. On top of this biblio there is added key "items" with value being array of items belonging to the requested biblio. As Magnus Enger pointed out, we should hide all the items defined in the OpacHiddenItems syspref from all but staff. This patch adds this functionality. To test: 1. Open a browser tab on Koha staff and log in (to create CGISESSID cookie). 2. Send GET request to http://yourlibrary/api/v1/biblios/YYY where YYY is an existing biblionumber. 3. Make sure the returned data is correct. 4. Find items which are hidden in OPAC with OpacHiddenItems syspref, note their record's biblionumber and repeat point 2 with it. 5. Check that if you are logged in as staff, you see all the items (even those hidden from OPAC) 6. Check that if you are not logged in as staff, you see only the items which are not hidden from OPAC 7. Run unit tests in t/db_dependent/api/v1/biblios.t Signed-off-by: Lari Taskula <larit@student.uef.fi> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 --- Comment #10 from Lari Taskula <larit@student.uef.fi> --- (In reply to Jiri Kozlovsky from comment #7)
Created attachment 53834 [details] [review] This patch removed commit message from the patch. I added it back from your comment field and merged it together with the original description. Hope it's ok now?
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 --- Comment #11 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54193 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54193&action=edit Bug 17007: Fix typo in biblio's Swagger definition By running the test introduced in Bug 17032, we can easily catch issues related to object definitions in Swagger vs. Koha-object's columns. This patch fixes a property typo in biblio.json -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion --- Comment #12 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- There has been some progress on getting Biblios in bug 17371, which is CRUD and it seems like this bug is subset of 17371, so we could eventually check that problems we have solved here were applied to 17371 and close this one as duplicate? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=17371 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17007 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|In Discussion |RESOLVED --- Comment #13 from Jiri Kozlovsky <mail@jkozlovsky.cz> --- bug 17371 is CRUD for biblios, thus it enables GET, POST & PUT - so after I've moved the OpacHiddenItems there, I'm closing this bug as duplicate *** This bug has been marked as a duplicate of bug 17371 *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org