Browse Source

Bug 17030: Enable REST api on packages

This patch enables access to the REST API endpoint on packages setup.
It does so, by patching the shared apache-shared-intranet.conf and
apache-shared-opac.conf.

You can build your own master packages with this patch applied, or just:

- Grab
  debian/templates/apache-shared-intranet.conf
  debian/templates/apache-shared-opac.conf
and overwrite their counterparts in /etc/koha on a packages setup. For example
in kohadevbox.
- Have Koha loaded with all default data
- Create a superlibrarian user for you
- Login to the intranet and the OPAC
- Point your browser to:
  http://localhost:8080/api/v1/patrons/51
=> SUCCESS: You get JSON data, for the patron you requested
  http://localhost:8081/api/v1/patrons/51
=> SUCCESS: You get JSON data, for the patron you requested
- Sign off :-D

Note: I use the HTTPRequester addon for Firefox, re-using the CGISESSID value from the
browser session cookie, in the headers.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
16.11.x
Tomás Cohen Arazi 8 years ago
committed by Kyle M Hall
parent
commit
6e38b8b60f
  1. 14
      debian/templates/apache-shared-intranet.conf
  2. 14
      debian/templates/apache-shared-opac.conf

14
debian/templates/apache-shared-intranet.conf

@ -17,3 +17,17 @@ RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
Alias "/api" "/usr/share/koha/api"
<Directory "/usr/share/koha/api">
Options +ExecCGI +FollowSymlinks
AddHandler cgi-script .pl
SetEnv MOJO_MODE "production"
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
</Directory>

14
debian/templates/apache-shared-opac.conf

@ -24,3 +24,17 @@ RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
Require all granted
</Directory>
</IfVersion>
Alias "/api" "/usr/share/koha/api"
<Directory "/usr/share/koha/api">
Options +ExecCGI +FollowSymlinks
AddHandler cgi-script .pl
SetEnv MOJO_MODE "production"
RewriteBase /api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
</Directory>

Loading…
Cancel
Save