Bug 13737

Summary: [OMNIBUS] Add Koha RESTful Services
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: Architecture, internals, and plumbingAssignee: Kyle M Hall (khall) <kyle>
Status: RESOLVED MOVED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: claire.hernandez, dcook, mirko, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 12272, 13738, 13799    
Bug Blocks:    
Attachments: Bug 13757: (regression tests) Empty attributes should delete existing
Bug 13757: Make Koha::Patron::Modification->store del empty attrs
Bug 13757: (QA followup) Make opac-memberentry.pl handle attrs deletion

Description Kyle M Hall (khall) 2015-02-20 13:27:11 UTC
We should add as many REST services as possible to Koha. This will not only give Koha the best third-party API possible, but we can utilize these services internally as well!
Comment 1 claire.hernandez@biblibre.com 2015-03-06 12:46:02 UTC
Links related to this topic: 

http://koha.1045719.n5.nabble.com/Koha-devel-f3063671.html

-- Mail from Julian Maurice wich summarize

Hi all,

During the hackfest in Marseille, we talked a lot about the new RESTful
API and how to integrate it into Koha.

Discussions have been summarized in the wiki page [1], in particular in
sections "Suggested way forward" and "API Protocol Specification".

A proof-of-concept patch was made and is attached to Bug 13799 [2].
It uses Mojolicious and its Swagger2 plugin (more details on the wiki page).
This will be used as a base for building the API. So, please have a look
at it and report any problem you can think of.


[1] http://wiki.koha-community.org/wiki/New_REST_API_RFC
[2] http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13799
Comment 2 Tomás Cohen Arazi (tcohen) 2017-01-31 15:59:28 UTC
Created attachment 59686 [details] [review]
Bug 13757: (regression tests) Empty attributes should delete existing

This patch introduces tests for the required functionality.

To test:
- Run:
  $ prove t/db_dependent/Koha/Patron/Modifications.t
=> FAIL: The current code doesn't work like that

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi (tcohen) 2017-01-31 15:59:33 UTC
Created attachment 59687 [details] [review]
Bug 13757: Make Koha::Patron::Modification->store del empty attrs

This patch makes Koha::Patron::Modification->store delete the passed
attributes that contain empty values.

This is the way it currently works, as all opac-editable attributes are
presented to the end-user and they are allowed to delete them, and the
best way I found to represent the deletion on the modification request
is by setting it to the empty string. I chose this way because it is how
the staff interface handles it, so it is consistent.

To test:
- Apply this patch
- Run:
  $ prove t/db_dependent/Koha/Patron/Modifications.t
=> SUCCESS: This time tests pass!
- Verify comment #70 on the bug is fixed now
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2017-01-31 15:59:36 UTC
Created attachment 59688 [details] [review]
Bug 13757: (QA followup) Make opac-memberentry.pl handle attrs deletion

The original code on this bug skipped empty-valued attributes. But
emptying attributes is the only way to tell the controller script that
the user wants to delete them.

This patch makes opac-memberentry.pl check the existence of attributes
sharing the code of the empty for the given patron, and it stores the
deletion on the Koha::Patron::Modification as needed. Otherwise
deletions got skipped.

To test:
- Verify setting/deleting attributes that are opac-editable and verify
the results are sound.
Comment 5 Tomás Cohen Arazi (tcohen) 2017-02-01 13:24:14 UTC
Wrong bug for attaching this patches.
Comment 6 Mirko Tietgen 2017-05-17 10:33:21 UTC
This is no omnibus for the actual REST API development going on. Can we close this bug?
Comment 7 Katrin Fischer 2017-06-05 10:44:30 UTC
I think discussion is taking place on other bug reports as Mirko suggested.