Bug 16497 - Add routes for library retrieval, update and deletion
Summary: Add routes for library retrieval, update and deletion
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: REST api (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL:
Keywords:
: 18102 (view as bug list)
Depends on: 18066 18137 22125
Blocks: 16652 18191 18102 19689
  Show dependency treegraph
 
Reported: 2016-05-11 12:38 UTC by Benjamin Rokseth
Modified: 2019-06-27 09:24 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
This new feature adds APIs to list all or individual libraries, and to add, update or delete a library where appropriate permissions are held.
Version(s) released in:


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
Bug 16497 - Add POD in Koha/REST/V1/Library.pm (1.67 KB, patch)
2017-12-05 15:11 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 16497: Add /api/v1/libraries (37.31 KB, patch)
2019-01-14 19:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (1.05 KB, patch)
2019-01-14 19:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: (follow-up) New column marcorgcode added (1.03 KB, patch)
2019-01-14 19:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: Add POD in Koha/REST/V1/Library.pm (1.73 KB, patch)
2019-01-14 19:19 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: (follow-up) Adapt to existing guidelines and RFC (42.42 KB, patch)
2019-01-14 19:19 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22125: branches.pickup_location should be flagged as boolean (1.15 KB, patch)
2019-01-15 11:09 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: Add /api/v1/libraries (37.38 KB, patch)
2019-01-15 11:24 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (1.11 KB, patch)
2019-01-15 11:24 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: (follow-up) New column marcorgcode added (1.08 KB, patch)
2019-01-15 11:24 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: Add POD in Koha/REST/V1/Library.pm (1.78 KB, patch)
2019-01-15 11:24 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: (follow-up) Adapt to existing guidelines and RFC (42.50 KB, patch)
2019-01-15 11:24 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 16497: (follow-up) GET operations require staff access (1.28 KB, patch)
2019-01-18 15:07 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: Add /api/v1/libraries (37.43 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: Add missing field in definitions due to bug 18066 (1.17 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: (follow-up) New column marcorgcode added (1.14 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: Add POD in Koha/REST/V1/Library.pm (1.84 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: (follow-up) Adapt to existing guidelines and RFC (42.54 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: (follow-up) GET operations require staff access (1.34 KB, patch)
2019-01-31 15:58 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 16497: (follow-up) GET operations require staff access (2.62 KB, patch)
2019-02-04 18:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 16497: Refactor tests using BASIC authentication (16.47 KB, patch)
2019-02-05 14:34 UTC, Tomás Cohen Arazi
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.
Comment 30 Alex Arnaud 2017-12-05 15:11:21 UTC
Created attachment 69508 [details] [review]
Bug 16497 - Add POD in Koha/REST/V1/Library.pm
Comment 31 Tomás Cohen Arazi 2017-12-21 17:05:58 UTC
Please:
- Implement using objects.search instead of manually crafting the DBIC query
- Please review the RFC I've just posted. If you add to it, add new column for your proposals. I plan to have it voted in Dec 27th's dev meeting so we can move on.

https://wiki.koha-community.org/wiki/Libraries_endpoint_RFC
Comment 32 Tomás Cohen Arazi 2019-01-14 19:18:48 UTC
Created attachment 83913 [details] [review]
Bug 16497: 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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 33 Tomás Cohen Arazi 2019-01-14 19:18:52 UTC
Created attachment 83914 [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 34 Tomás Cohen Arazi 2019-01-14 19:18:57 UTC
Created attachment 83915 [details] [review]
Bug 16497: (follow-up) New column marcorgcode added

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 35 Tomás Cohen Arazi 2019-01-14 19:19:02 UTC
Created attachment 83916 [details] [review]
Bug 16497: Add POD in Koha/REST/V1/Library.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 36 Tomás Cohen Arazi 2019-01-14 19:19:07 UTC
Created attachment 83917 [details] [review]
Bug 16497: (follow-up) Adapt to existing guidelines and RFC

This patch makes the original implementation match what is specified on
the RFC [1].

The controller is updated, and so the tests.

To test:
- Apply this patches:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/libraries.t
=> SUCCESS: Tests pass!

[1] https://wiki.koha-community.org/wiki/Libraries_endpoint_RFC

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 37 Tomás Cohen Arazi 2019-01-14 19:21:46 UTC
I've just implemented what I mentioned on comment 31. The attributes got adapted to the voted RFC and the implementation now is more in line with the current practices we adopted.

I'm setting it NSO.
Comment 38 Josef Moravec 2019-01-15 11:09:23 UTC
Created attachment 83943 [details] [review]
Bug 22125: branches.pickup_location should be flagged as boolean

This trivial patch just marks the mentioned column as a boolean.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 39 Josef Moravec 2019-01-15 11:11:03 UTC
Comment on attachment 83943 [details] [review]
Bug 22125: branches.pickup_location should be flagged as boolean

Sorry, wrong bug number
Comment 40 Josef Moravec 2019-01-15 11:24:06 UTC
Created attachment 83945 [details] [review]
Bug 16497: 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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 41 Josef Moravec 2019-01-15 11:24:10 UTC
Created attachment 83946 [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>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 42 Josef Moravec 2019-01-15 11:24:14 UTC
Created attachment 83947 [details] [review]
Bug 16497: (follow-up) New column marcorgcode added

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 43 Josef Moravec 2019-01-15 11:24:18 UTC
Created attachment 83948 [details] [review]
Bug 16497: Add POD in Koha/REST/V1/Library.pm

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 44 Josef Moravec 2019-01-15 11:24:22 UTC
Created attachment 83949 [details] [review]
Bug 16497: (follow-up) Adapt to existing guidelines and RFC

This patch makes the original implementation match what is specified on
the RFC [1].

The controller is updated, and so the tests.

To test:
- Apply this patches:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/libraries.t
=> SUCCESS: Tests pass!

[1] https://wiki.koha-community.org/wiki/Libraries_endpoint_RFC

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 45 Josef Moravec 2019-01-15 11:26:38 UTC
*** Bug 18102 has been marked as a duplicate of this bug. ***
Comment 46 Tomás Cohen Arazi 2019-01-18 15:07:27 UTC
Created attachment 84198 [details] [review]
Bug 16497: (follow-up) GET operations require staff access

With the introduction of the /public namespace all other endpoints, the
rest of the endpoints are restricted to privileged users.

This patch makes the GET /libraries and GET /libraries/:library_id
endpoints require 'catalogue' permissions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 47 Martin Renvoize 2019-01-31 15:58:31 UTC
Created attachment 84588 [details] [review]
Bug 16497: 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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 48 Martin Renvoize 2019-01-31 15:58:35 UTC
Created attachment 84589 [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>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 49 Martin Renvoize 2019-01-31 15:58:39 UTC
Created attachment 84590 [details] [review]
Bug 16497: (follow-up) New column marcorgcode added

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 50 Martin Renvoize 2019-01-31 15:58:43 UTC
Created attachment 84591 [details] [review]
Bug 16497: Add POD in Koha/REST/V1/Library.pm

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 51 Martin Renvoize 2019-01-31 15:58:47 UTC
Created attachment 84592 [details] [review]
Bug 16497: (follow-up) Adapt to existing guidelines and RFC

This patch makes the original implementation match what is specified on
the RFC [1].

The controller is updated, and so the tests.

To test:
- Apply this patches:
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/libraries.t
=> SUCCESS: Tests pass!

[1] https://wiki.koha-community.org/wiki/Libraries_endpoint_RFC

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 52 Martin Renvoize 2019-01-31 15:58:51 UTC
Created attachment 84593 [details] [review]
Bug 16497: (follow-up) GET operations require staff access

With the introduction of the /public namespace all other endpoints, the
rest of the endpoints are restricted to privileged users.

This patch makes the GET /libraries and GET /libraries/:library_id
endpoints require 'catalogue' permissions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 53 Martin Renvoize 2019-01-31 16:00:27 UTC
A solid implementation, well tested, passes qa scripts.

Passing QA
Comment 54 Tomás Cohen Arazi 2019-02-04 18:54:31 UTC
Created attachment 84734 [details] [review]
Bug 16497: (follow-up) GET operations require staff access

With the introduction of the /public namespace all other endpoints, the
rest of the endpoints are restricted to privileged users.

This patch makes the GET /libraries and GET /libraries/:library_id
endpoints require 'catalogue' permissions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 55 Tomás Cohen Arazi 2019-02-05 14:34:12 UTC
Created attachment 84769 [details] [review]
Bug 16497: Refactor tests using BASIC authentication

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 56 Nick Clemens 2019-02-19 13:58:21 UTC
Awesome work all!

Pushed to master for 19.05
Comment 57 Martin Renvoize 2019-02-25 19:03:19 UTC
As per my policy of backporting new api routes to aid developers of plugins and other api reliant third party integrations I have pushed this to 18.11.x for 18.11.04
Comment 58 Lucas Gass 2019-03-06 17:32:13 UTC
18.05.x is missing 22125 dependency, won't backport