Using the Koha REST API
From Koha Wiki
Koha has an old, RESTish API, referred to as SVC. A new REST API is being added from scratch, and this page aims to inform non-Koha developers about how to develop against this new API.
The REST API is self documenting, so you can view documentation describing the actual version you will be working with at the following URL:
Here is a live example, from a demo installation:
Can be enabled with the RESTOAuth2ClientCredentials syspref.
Can be enabled with the RESTBasicAuth syspref. Uses the username and password of a patron/borrower registered in Koha.
Simple example in Perl
This will fetch a list of libraries from the Koha instance:
use Modern::Perl; use LWP::UserAgent; use HTTP::Request::Common; my $domain = 'example.com'; my $username = 'foo'; my $password = 'bar'; my $ua = LWP::UserAgent->new(); my $request = GET "https://$domain/api/v1/libraries"; $request->authorization_basic( $username, $password ); my $response = $ua->request($request); say $response->as_string();
Added in Bug 22132, and part of Koha from the following versions:
The REST API can be extended through Koha plugins. See the Kitchen sink example plugin from ByWater for an example.