Bug 16497

Summary: Add routes for library retrieval, update and deletion
Product: Koha Reporter: Benjamin Rokseth <benjamin.rokseth>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: new feature    
Priority: P5 - low CC: alex.arnaud, david, jonathan.druart, josef.moravec, kyle, lari.taskula, lucas, m.de.rooy, mail, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13895
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
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:
Bug Depends on: 18066, 18137, 22125    
Bug Blocks: 16652, 18102, 18191, 19689    
Attachments: Bug 16497 - REST API: add routes to list libraries
Bug 16497 - REST API: add routes to list libraries
Bug 14793: New cataloguing plugin unimarc_field_225a_bis
Bug 16497 - REST API: add routes to list libraries
Bug 16497 - REST API: add routes to list libraries
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: Sort definitions.json
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: Sort definitions.json
[SIGNED-OFF] Bug 16497: [REST] Add /api/v1/libraries
[SIGNED-OFF] Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: (followup) New column marcorgcode added
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: [REST] Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: (followup) New column marcorgcode added
Bug 16497 - Add POD in Koha/REST/V1/Library.pm
Bug 16497: Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: (follow-up) New column marcorgcode added
Bug 16497: Add POD in Koha/REST/V1/Library.pm
Bug 16497: (follow-up) Adapt to existing guidelines and RFC
Bug 22125: branches.pickup_location should be flagged as boolean
Bug 16497: Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: (follow-up) New column marcorgcode added
Bug 16497: Add POD in Koha/REST/V1/Library.pm
Bug 16497: (follow-up) Adapt to existing guidelines and RFC
Bug 16497: (follow-up) GET operations require staff access
Bug 16497: Add /api/v1/libraries
Bug 16497: Add missing field in definitions due to bug 18066
Bug 16497: (follow-up) New column marcorgcode added
Bug 16497: Add POD in Koha/REST/V1/Library.pm
Bug 16497: (follow-up) Adapt to existing guidelines and RFC
Bug 16497: (follow-up) GET operations require staff access
Bug 16497: (follow-up) GET operations require staff access
Bug 16497: Refactor tests using BASIC authentication

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