[Bug 34008] New: REST API: Add a list (GET) endpoint for itemtypes
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Bug ID: 34008 Summary: REST API: Add a list (GET) endpoint for itemtypes Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com CC: tomascohen@gmail.com -- 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=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andreas.jonsson@kreablo.se Assignee|koha-bugs@lists.koha-commun |andreas.jonsson@kreablo.se |ity.org | -- 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=34008 --- Comment #1 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- I'm peeking at the authorised_values and see that it requires permission catalogue. So, I will assume that this is appropriate also for item types. I will also prefer 'itemtypes' over 'item_types' as itemtypes is far more commonly used in the code base. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #2 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 155734 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=155734&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|andreas.jonsson@kreablo.se |koha-bugs@lists.koha-commun | |ity.org 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=34008 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Status|Needs Signoff |Failed QA --- Comment #3 from David Nind <david@davidnind.com> --- Hi Andreas. I've had a go at testing using koha-testing-docker (KTD) (note: I'm not a developer, and APIs are not something I know a lot about!). 1. Using either curl or Postman for the requests, I get "Page Not Found (development mode)" (curl = HTML output; postman = the same). 2. The API documentation also comes up with page not found (http://127.0.0.1:8081/api/v1/.html) 3. I tested with another REST API bug for sign off (bug 34333), and this didn't happen. Also, when I go back to master, the API docs are available again. 4. Possibly, this is something to do with the KTD set up? Or something isn't working as expected with your bug? David Nind -- 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=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #155734|0 |1 is obsolete| | --- Comment #4 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 155737 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=155737&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any -- 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=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #155737|0 |1 is obsolete| | --- Comment #5 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 155738 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=155738&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any -- 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=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #155738|0 |1 is obsolete| | --- Comment #6 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 155739 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=155739&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any -- 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=34008 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #7 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Thank you for testing David! It seems that the patch did not work on master due to Bug 33971 removing the q_header parameter from the API, which caused the loading of the API-schema to fail. I have updated the patch. -- 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=34008 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. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #155739|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 155741 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=155741&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any Signed-off-by: David Nind <david@davidnind.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=34008 --- Comment #9 from David Nind <david@davidnind.com> --- (In reply to Andreas Jonsson from comment #7)
Thank you for testing David!
....
I have updated the patch.
Thanks Andreas! It is now working and I've sigend it off. -- 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=34008 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |andreas.jonsson@kreablo.se |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=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #155741|0 |1 is obsolete| | --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 157915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157915&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] perltidy -b t/db_dependent/api/v1/itemtypes.t # Resolve bad score of 44 [EDIT] chmod 755 t/db_dependent/api/v1/itemtypes.t [EDIT] perltidy -b Koha/REST/V1/ItemTypes.pm Lesson: Please run qa tools yourself and adjust accordingly? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl QA Contact|tomascohen@gmail.com |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_23_11_candidate --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I see a few problems with this implementation. I'm marking this one rel_23_11_candidate because they are easily solvable and I can help. * What I will need input on is on the attributes names. This needs work. To start with, we call them item_type across the other endpoints. So the endpoint name and the id need a change. The rest of the attribute names need some love (i.e. we hide our weird internal names and put something better, along with a mapping). * The controller shouldn't deal explicitly with embeds. Pick the /cities endpoint controller as an example and you'll be fine. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #12 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 157976 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157976&action=edit Bug 34008: Remove explicit embed in controller. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #13 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 157977 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157977&action=edit Bug 34008: Rename item_type in api. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #14 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- * I have removed the explicit embed. * I've attached a patch for renaming to item_type * As for renaming other attributes I am open to suggestions. My personal preference is to stay consistent with the database column names, however. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #15 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Thank you, Marcel, for tidying up the code! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Andreas Jonsson from comment #14)
* I have removed the explicit embed.
Good!
* I've attached a patch for renaming to item_type
Good!
* As for renaming other attributes I am open to suggestions. My personal preference is to stay consistent with the database column names, however.
https://wiki.koha-community.org/wiki/Coding_Guidelines_-_API#SWAGGER1.2:_Res... and we have used RFCs to propose attribute namings in the past: https://wiki.koha-community.org/wiki/REST_api_RFCs I wouldn't suggest you add an RFC, but pick ideas from there. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I made some suggestions on the wiki page you added: https://wiki.koha-community.org/wiki/Item_types_endpoint_RFC >From looking at the other endpoints I concluded: * we usually don't use abbreviations * we use underscores to separate words * items endpoint uses not_for_loan_status - so we should use: not_for_loan -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |BLOCKED --- Comment #18 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Working on follow-ups for this one. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #19 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #17)
I made some suggestions on the wiki page you added: https://wiki.koha-community.org/wiki/Item_types_endpoint_RFC
From looking at the other endpoints I concluded: * we usually don't use abbreviations * we use underscores to separate words * items endpoint uses not_for_loan_status - so we should use: not_for_loan
Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #157915|0 |1 is obsolete| | Attachment #157976|0 |1 is obsolete| | Attachment #157977|0 |1 is obsolete| | --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 158082 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158082&action=edit Bug 34008: Add REST endpoint for list of itemtypes Test plan: * Enable the system preference RESTBasicAuth * curl -s --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should give 401 Unauthorized * curl -s -u koha:koha --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should produce JSON-list of itemtypes * curl -s -u koha:koha --header "x-koha-embed: translated_descriptions" --request GET http://kohadev-intra.mydnsname.org:8081/api/v1/itemtypes should include the field translated_descriptions containing the translated descriptions, if any Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [EDIT] perltidy -b t/db_dependent/api/v1/itemtypes.t # Resolve bad score of 44 [EDIT] chmod 755 t/db_dependent/api/v1/itemtypes.t [EDIT] perltidy -b Koha/REST/V1/ItemTypes.pm Lesson: Please run qa tools yourself and adjust accordingly? Edit (tcohen): I restored the item_type_translated_description.yaml file as the entire API was broken because of the lack of it. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #21 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 158083 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158083&action=edit Bug 34008: (QA follow-up) 'item_type_id' should be used Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #22 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 158084 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158084&action=edit Bug 34008: Harmonize attribute names This patch harmonizes the attribute names with what is used for `items` and `checkouts` in terms of terminology. It also adapts the tests so they are less random failure-prone (they had a fixed value for the item type, which might make things explode if the chosen value already exists on the DB. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 --- Comment #23 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Version(s)|23.11.00 |23.11.00,23.05.06 released in| | Status|Pushed to master |Pushed to stable --- Comment #24 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.05.x for 23.05.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED CC| |pedro.amorim@ptfs-europe.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34008 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com --- Comment #25 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- *** Bug 17856 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org