Bug 16497 - Add routes to list libraries
Summary: Add routes to list libraries
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: REST api (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jiri Kozlovsky
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 18066 18137
Blocks: 16652 18102 18191
  Show dependency treegraph
 
Reported: 2016-05-11 12:38 UTC by Benjamin Rokseth
Modified: 2017-11-01 16:09 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 16497 - REST API: add routes to list libraries (9.85 KB, patch)
2016-05-12 09:32 UTC, Benjamin Rokseth
Details | Diff | Splinter Review
Bug 16497 - REST API: add routes to list libraries (9.89 KB, patch)
2016-06-27 16:08 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 14793: New cataloguing plugin unimarc_field_225a_bis (5.32 KB, patch)
2016-07-31 09:38 UTC, Jiri Kozlovsky
Details | Diff | Splinter Review
Bug 16497 - REST API: add routes to list libraries (10.04 KB, patch)
2016-07-31 09:49 UTC, Jiri Kozlovsky
Details | Diff | Splinter Review
Bug 16497 - REST API: add routes to list libraries (10.88 KB, patch)
2016-08-26 23:31 UTC, Benjamin Rokseth
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (36.01 KB, patch)
2017-03-02 17:21 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 16497: Sort definitions.json (1.07 KB, patch)
2017-03-02 17:21 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (37.03 KB, patch)
2017-03-16 12:22 UTC, Lari Taskula
Details | Diff | Splinter Review
Bug 16497: Sort definitions.json (1.07 KB, patch)
2017-03-16 12:22 UTC, Lari Taskula
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 16497: [REST] Add /api/v1/libraries (37.10 KB, patch)
2017-05-05 10:51 UTC, Josef Moravec
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 16497: Add missing field in definitions due to bug 18066 (905 bytes, patch)
2017-05-05 10:51 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (37.16 KB, patch)
2017-09-05 10:16 UTC, Benjamin Rokseth
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (962 bytes, patch)
2017-09-05 10:16 UTC, Benjamin Rokseth
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (37.21 KB, patch)
2017-10-27 15:09 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (1017 bytes, patch)
2017-10-27 15:09 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: (followup) New column marcorgcode added (987 bytes, patch)
2017-10-27 15:09 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (37.27 KB, patch)
2017-10-30 10:23 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16497: [REST] Add /api/v1/libraries (37.27 KB, patch)
2017-10-30 10:40 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (1.05 KB, patch)
2017-10-30 10:40 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16497: (followup) New column marcorgcode added (1.02 KB, patch)
2017-10-30 10:40 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Rokseth 2016-05-11 12:38:05 UTC
Small enhancement to REST API to add the possibility to list libraries.

GET /api/v1/libraries              List all libraries and branchcodes
GET /api/v1/libraries/{branchcode} Get library description and branchcode
Comment 1 Benjamin Rokseth 2016-05-12 09:32:24 UTC Comment hidden (obsolete)
Comment 2 Lari Taskula 2016-06-27 16:08:21 UTC Comment hidden (obsolete)
Comment 3 Jiri Kozlovsky 2016-07-31 09:38:06 UTC Comment hidden (obsolete)
Comment 4 Jiri Kozlovsky 2016-07-31 09:49:26 UTC Comment hidden (obsolete)
Comment 5 Jiri Kozlovsky 2016-07-31 09:50:21 UTC
Comment on attachment 53818 [details] [review]
Bug 14793: New cataloguing plugin unimarc_field_225a_bis

Sorry about this patch, my git bz did not function correctly.
Comment 6 Lari Taskula 2016-08-09 10:24:34 UTC
We should figure out what to do for properties 'issuing' and 'branchprinter'. They are missing from api/v1/definitions/library.json but I would guess the reason is that Benjamin noticed kohastructure mentioning that they are not used in Koha. Perhaps they should be completely removed everywhere?

I noticed this issue by running the test introduced in Bug 17032 which won't pass this definition because it sees these two "missing" properties.
Comment 7 Benjamin Rokseth 2016-08-26 23:31:36 UTC
Created attachment 54943 [details] [review]
Bug 16497 - REST API: add routes to list libraries

Simple routes to list all or get one Library
GET /api/v1/libraries              - List all libraries
GET /api/v1/libraries/{branchcode} - Get one Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Lari Taskula <larit@student.uef.fi>
Signed-off-by: Jiří Kozlovský <mail@jkozlovsky.cz>
Comment 8 Benjamin Rokseth 2016-08-26 23:32:27 UTC
Rebased against 16699
Comment 9 Jonathan Druart 2016-11-01 10:00:24 UTC
I think this patch must be rewritten following what has been done in bug 17428 for Cities.
Comment 10 Benjamin Rokseth 2016-11-01 10:25:21 UTC
Yup.

Perhaps even CRUD? or is that overkill?
Comment 11 Jonathan Druart 2016-11-01 10:46:16 UTC
(In reply to Benjamin Rokseth from comment #10)
> Yup.
> 
> Perhaps even CRUD? or is that overkill?

That seems overkill to me, but not so hard to implement.
It may make sense to be consistent and supply CRUD for such object.
Comment 12 Lari Taskula 2017-03-02 17:21:00 UTC
Created attachment 60801 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl
Comment 13 Lari Taskula 2017-03-02 17:21:23 UTC
Created attachment 60802 [details] [review]
Bug 16497: Sort definitions.json

Before this file grows, we should sort it alphabetically.
Comment 14 Lari Taskula 2017-03-02 17:30:46 UTC
Here is CRUD. I switched this bug report to Needs Signoff without thinking first; we should do the migration from Swagger2 to Mojolicious::Plugin::OpenAPI before pushing adding more REST API stuff. See Bug 18137. So I am going to revert the status of this bug report back to In Discussion until we proceed with the migration.
Comment 15 Lari Taskula 2017-03-16 12:22:10 UTC
Created attachment 61164 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl
Comment 16 Lari Taskula 2017-03-16 12:22:27 UTC
Created attachment 61165 [details] [review]
Bug 16497: Sort definitions.json

Before this file grows, we should sort it alphabetically.
Comment 17 Josef Moravec 2017-05-05 10:51:16 UTC
Created attachment 63160 [details] [review]
[SIGNED-OFF] Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 18 Josef Moravec 2017-05-05 10:51:23 UTC
Created attachment 63161 [details] [review]
[SIGNED-OFF] Bug 16497: Add missing field in definitions due to bug 18066

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 19 Benjamin Rokseth 2017-09-05 10:16:19 UTC
Created attachment 66837 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Comment 20 Benjamin Rokseth 2017-09-05 10:16:29 UTC
Created attachment 66838 [details] [review]
Bug 16497: Add missing field in definitions due to bug 18066

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Comment 21 Kyle M Hall 2017-10-27 14:35:58 UTC
Massive unit test failures. Is the test plan incomplete, or perhaps the automerge from git isn't going right?
Comment 22 Tomás Cohen Arazi 2017-10-27 15:09:12 UTC
Created attachment 68746 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 23 Tomás Cohen Arazi 2017-10-27 15:09:19 UTC
Created attachment 68747 [details] [review]
Bug 16497: Add missing field in definitions due to bug 18066

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 24 Tomás Cohen Arazi 2017-10-27 15:09:24 UTC
Created attachment 68748 [details] [review]
Bug 16497: (followup) New column marcorgcode added

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 25 Kyle M Hall 2017-10-30 10:23:44 UTC
Created attachment 68838 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 26 Kyle M Hall 2017-10-30 10:40:06 UTC
Created attachment 68839 [details] [review]
Bug 16497: [REST] Add /api/v1/libraries

CRUD for libraries via REST API.

GET    /api/v1/libraries              - List all libraries
GET    /api/v1/libraries/{branchcode} - Get one Library
POST   /api/v1/libraries              - Add new Library
DELETE /api/v1/libraries/{branchcode} - Delete Library

Test plan:
  - apply patch
  - run tests: t/db_dependent/api/v1/libraries.t
  - test API with some API tool or simple curl

e.g.:
curl http://host:port/api/v1/libraries
curl http://host:port/api/v1/libraries/cpl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 27 Kyle M Hall 2017-10-30 10:40:13 UTC
Created attachment 68840 [details] [review]
Bug 16497: Add missing field in definitions due to bug 18066

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 28 Kyle M Hall 2017-10-30 10:40:16 UTC
Created attachment 68841 [details] [review]
Bug 16497: (followup) New column marcorgcode added

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 29 Jonathan Druart 2017-11-01 16:09:13 UTC
Please check POD coverage.