]> git.koha-community.org Git - koha.git/commit
Bug 16330: Add routes to add, update and delete patrons
authorBenjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Wed, 27 Apr 2016 13:47:04 +0000 (13:47 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 29 Mar 2018 14:42:06 +0000 (11:42 -0300)
commit7b8909cb9080216352b0a68564476c8861f7e790
tree440db0f7b48d8b22b3c8cd31acb485ec4ff6b8fc
parent275c5bd4fa11c30606d11d7bfb2eab8c0a31ed04
Bug 16330: Add routes to add, update and delete patrons

This patch adds support for add, edit and delete patrons via REST API.

GET  /api/v1/patrons                   Get patron list from params
GET  /api/v1/patrons/<borrowernumber>  Get single patron
POST /api/v1/patrons                   Create a new patron
PUT  /api/v1/patrons/<borrowernumber>  Update data about patron
DEL  /api/v1/patrons/<borrowernumber>  Delete a patron

Revised Test plan:
1) Apply this patch
2) Run tests perl t/db_dependent/api/v1/patrons.t
3) Add a user with proper rights to use the REST API
4) play with your favourite REST client (curl/httpie, etc.):
   Authenticate with the user created above and get a CGISESSION id.
   Use the CGISESSION to add, edit and delete patrons via the API.
5) Use PUT /patrons/<borrowernumber> for a patron without borrowers
   flag. This should go into pending patron modification status and
   needs to be accepted by a librarian.

Please note there is no validation of body input in PUT/POST other
than branchcode,category,userid,cardnumber.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Exceptions.pm
Koha/Exceptions/Category.pm [new file with mode: 0644]
Koha/Exceptions/Library.pm [new file with mode: 0644]
Koha/Exceptions/Patron.pm [new file with mode: 0644]
Koha/Patron.pm
Koha/REST/V1/Patron.pm
api/v1/swagger/definitions/patron.json
api/v1/swagger/paths/patrons.json
t/db_dependent/Koha/Patrons.t
t/db_dependent/api/v1/patrons.t