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

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 26 14:37:52 CET 2015


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

Kyle M Hall <kyle at bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #43204|0                           |1
        is obsolete|                            |
  Attachment #43205|0                           |1
        is obsolete|                            |
  Attachment #43206|0                           |1
        is obsolete|                            |
  Attachment #43207|0                           |1
        is obsolete|                            |
  Attachment #43208|0                           |1
        is obsolete|                            |
  Attachment #43209|0                           |1
        is obsolete|                            |
  Attachment #43210|0                           |1
        is obsolete|                            |
  Attachment #43211|0                           |1
        is obsolete|                            |
  Attachment #43212|0                           |1
        is obsolete|                            |
  Attachment #43213|0                           |1
        is obsolete|                            |
  Attachment #43214|0                           |1
        is obsolete|                            |
  Attachment #43980|0                           |1
        is obsolete|                            |
  Attachment #43987|0                           |1
        is obsolete|                            |

--- Comment #200 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 43989
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=43989&action=edit
[PASSED QA] 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

Change both OPAC and Intranet VirtualHosts to access the API,
so we have:
  http://OPAC/api/v1/swagger.json   Swagger specification
  http://OPAC/api/v1/{path}         API endpoint
  http://INTRANET/api/v1/swagger.json   Swagger specification
  http://INTRANET/api/v1/{path}         API endpoint

Add a (disabled) virtual host in Apache configuration api.HOSTNAME,
so we have:
  http://api.HOSTNAME/api/v1/swagger.json   Swagger specification
  http://api.HOSTNAME/api/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/ Check that http://(OPAC|INTRANET)/api/v1/borrowers and
     http://(OPAC|INTRANET)/api/v1/borrowers/{borrowernumber} works

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

Signed-off-by: Alex Arnaud <alex.arnaud at biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize at ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

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


More information about the Koha-bugs mailing list