[Koha-bugs] [Bug 13799] Add base for building RESTful API

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 24 11:12:31 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13799

--- Comment #88 from Julian Maurice <julian.maurice at biblibre.com> ---
Created attachment 40560
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40560&action=edit
Bug 13799: RESTful API with Mojolicious and Swagger2

Actual routes are:
  /borrowers
    Return a list of all borrowers in Koha

  /borrowers/{borrowernumber}
    Return the borrower identified by {borrowernumber}
    (eg. /borrowers/1)

There is a test file you can run with:
  $ prove t/db_dependent/rest/borrowers.t

All API stuff is in /api/v1 (except Perl modules)
So we have:
  /api/v1/script.cgi     CGI script
  /api/v1/swagger.json   Swagger specification
  /api/v1/doc            Swagger UI (documentation)

Add a virtual host in Apache configuration api.HOSTNAME
So we have:
  http://api.HOSTNAME/v1/swagger.json   Swagger specification
  http://api.HOSTNAME/v1/doc            Swagger UI (documentation)
  http://api.HOSTNAME/v1/{path}         API endpoint

Add 'unblessed' subroutines to both Koha::Objects and Koha::Object to be
able to pass it to Mojolicious

Test plan:
  1/ Install Perl modules Mojolicious and Swagger2
  2/ perl Makefile.PL
  3/ make && make install
  4/ Change etc/koha-httpd.conf and copy it to the right place if needed
  5/ Reload Apache
  6/ Go to http://api.HOSTNAME/v1/doc and check everything works
  7/ Also check that http://api.HOSTNAME/v1/borrowers and
     http://api.HOSTNAME/v1/borrowers/{borrowernumber} works

Optionally, you could verify that http://api.HOSTNAME/vX/borrowers
(where X is an integer greater than 1) returns a 404 error

For the new vhost to work, you may need to modify your /etc/hosts file
if you run Koha locally.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list