[Bug 41463] New: Add Koha REST API endpoints for OAI sets and biblios
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Bug ID: 41463 Summary: Add Koha REST API endpoints for OAI sets and biblios Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: aleisha@catalyst.net.nz QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com -- 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=41463 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |aleisha@catalyst.net.nz |ity.org | Sponsorship status|--- |Sponsored -- 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=41463 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41462 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41462 [Bug 41462] Koha objects namespace for OAI sets and biblios -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 --- Comment #1 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 190565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190565&action=edit Bug 41463: [WIP] oai_sets REST API endpoint -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add Koha REST API endpoints |Add Koha REST API endpoints |for OAI sets and biblios |for OAI sets -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190565|0 |1 is obsolete| | --- Comment #2 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 190610 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190610&action=edit Bug 41463: [WIP] oai_sets REST API endpoint -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Aleisha Amohia <aleisha@catalyst.net.nz> 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=41463 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190610|0 |1 is obsolete| | --- Comment #3 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 190631 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190631&action=edit Bug 41463: REST API endpoint to gain information about an OAI set This API endpoint is to be used like: "/api/v1/oai_sets/{set_id}" and shows the following information about an OAI set: - set name - set spec - set ID - total count of items in the set - count of items in the set which also exist in the catalogue - this is useful for determining how many items have been deleted from the catalogue but has not yet been reflected in the OAI set To test: 1. Apply the patch and rebuild resources for the new API endpoints to take effect, then restart services. In KTD this looks like: perl ./build-resources.PL yarn api:bundle restart_all 2. Confirm the new getOAISet definition is available to the API: OPAC-URL/api/v1/.html 3. In the staff interface, go to Koha administration -> OAI sets configuration and create a new set. Give it a spec and name then Save. Go to edit mappings and add the following rule, then Save: - Field: 942 - Subfield: n - Operator: not equal to - Value: 1 (This would essentially exclude items from the set that are OPAC suppressed) 4. Search for a record and edit it. Go to tab 9 to find tag 942 and set n to "No". Saving the record will add it to the OAI set. 5. Now we need to add some items to the set that don't match biblios in the catalogue. The easiest way to do this is by directly adding fake items to the set in the database, something like this: sudo koha-mysql kohadev insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); insert into oai_sets_biblios (biblionumber, set_id) values (123456378, 1); insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); So we now have 4 items in the set - 1 that matches an existing biblio in the catalogue, and 3 that don't (in practise, they may have existed once, but have since been deleted and the set hasn't harvested those deletions). 6. Go to the API endpoint for your set and confirm the correction information is fetched: OPAC-URL/api/v1/oai_sets/{set_id} 7. Confirm tests pass: prove t/db_dependent/OAI/Sets.t prove t/db_dependent/api/v1/oai_sets.t Sponsored-by: Auckland University of Technology -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #4 from David Nind <david@davidnind.com> --- Not sure what the expected result from steps 5 and 6 is - I only get 3 items in the set. Should the record edited in step 4 be included in the result? Testing notes (using KTD): 1. When adding the third item in step 5 I get: insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); ERROR 1062 (23000): Duplicate entry '12345678-1' for key 'PRIMARY' 2. I can add a third item to the set if I make it unique: insert into oai_sets_biblios (biblionumber, set_id) values (123456789, 1); Query OK, 1 row affected (0.003 sec) 3. If I select everything from the table, I only get three rows: select * from oai_sets_biblios; +--------------+--------+ | biblionumber | set_id | +--------------+--------+ | 12345678 | 1 | | 123456378 | 1 | | 123456789 | 1 | +--------------+--------+ 3 rows in set (0.000 sec) 4. The results from /api/v1/oai_sets/1 for step 6 is: { "catalog_count": 1, "name": "A", "set_id": 1, "spec": "A", "total_count": 3 } -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 --- Comment #5 from Aleisha Amohia <aleisha@catalyst.net.nz> --- (In reply to David Nind from comment #4)
Not sure what the expected result from steps 5 and 6 is - I only get 3 items in the set.
Should the record edited in step 4 be included in the result?
Yes it should - when I edited the record, it was added to the OAI set automatically. Maybe some other setting is also needed for that to happen for you...
Testing notes (using KTD):
1. When adding the third item in step 5 I get: insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); ERROR 1062 (23000): Duplicate entry '12345678-1' for key 'PRIMARY'
Oops sorry bad copy paste in my test plan!
2. I can add a third item to the set if I make it unique: insert into oai_sets_biblios (biblionumber, set_id) values (123456789, 1); Query OK, 1 row affected (0.003 sec)
3. If I select everything from the table, I only get three rows: select * from oai_sets_biblios; +--------------+--------+ | biblionumber | set_id | +--------------+--------+ | 12345678 | 1 | | 123456378 | 1 | | 123456789 | 1 | +--------------+--------+ 3 rows in set (0.000 sec)
4. The results from /api/v1/oai_sets/1 for step 6 is:
{ "catalog_count": 1, "name": "A", "set_id": 1, "spec": "A", "total_count": 3 }
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190631|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 201506 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201506&action=edit Bug 41463: REST API endpoint to gain information about an OAI set This API endpoint is to be used like: "/api/v1/oai_sets/{set_id}" and shows the following information about an OAI set: - set name - set spec - set ID - total count of items in the set - count of items in the set which also exist in the catalogue - this is useful for determining how many items have been deleted from the catalogue but has not yet been reflected in the OAI set To test: 1. Apply the patch and rebuild resources for the new API endpoints to take effect, then restart services. In KTD this looks like: perl ./build-resources.PL yarn api:bundle restart_all 2. Confirm the new getOAISet definition is available to the API: OPAC-URL/api/v1/.html 3. In the staff interface, go to Koha administration -> OAI sets configuration and create a new set. Give it a spec and name then Save. Go to edit mappings and add the following rule, then Save: - Field: 942 - Subfield: n - Operator: not equal to - Value: 1 (This would essentially exclude items from the set that are OPAC suppressed) 4. Search for a record and edit it. Go to tab 9 to find tag 942 and set n to "No". Saving the record will add it to the OAI set. 5. Now we need to add some items to the set that don't match biblios in the catalogue. The easiest way to do this is by directly adding fake items to the set in the database, something like this: sudo koha-mysql kohadev insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); insert into oai_sets_biblios (biblionumber, set_id) values (123456378, 1); insert into oai_sets_biblios (biblionumber, set_id) values (12345678, 1); So we now have 4 items in the set - 1 that matches an existing biblio in the catalogue, and 3 that don't (in practise, they may have existed once, but have since been deleted and the set hasn't harvested those deletions). 6. Go to the API endpoint for your set and confirm the correction information is fetched: OPAC-URL/api/v1/oai_sets/{set_id} 7. Confirm tests pass: prove t/db_dependent/OAI/Sets.t prove t/db_dependent/api/v1/oai_sets.t Sponsored-by: Auckland University of Technology -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I've fixed a small conflict in the yaml file and uploaded the patch. QA tests and unit tests pass after. 1) I have been wondering about these: + total_count: + type: integer + description: Number of total items in the set + catalog_count: + type: integer + description: Number of items which exist both in the set and in the catalog +additionalProperties: false +required: What is the use case for differentiating the number records in the set vs. the number of records in the catalog? 2) Also: For the documentation, would 'records' not be better than 'items'? I know lists have items too, but it Koha terms records or even bibliographic records might be helpful to avoid misunderstandings. ---- For the auto-updating of OAI sets (question from David) OAI-PMH:AutoUpdateSets needs to be active. Failed QA to get attention for the questions. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41463 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Hi, I wanted to add to the FQA, that the selected endpoint is the natural candidate for CRUD operations on OAI set specs. But the introduced functionality is more like a 'status' endpoint for OAI sets... Please pick something like ``` GET /oai_sets/:oai_set_id/stats ``` Cheers -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org