Koha::SVC
Call Koha's /svc/
API to fetch/update records
This script can be used from other scripts as Koha::SVC
module or run directly using syntax:
koha-svc.pl http://koha-dev:8080/cgi-bin/koha/svc svc-user svc-password $biblionumber [bib-42.xml]
If called without last argument (MARCXML filename) it will fetch $biblionumber
from Koha and create bib-$biblionumber.xml
file from it. When called with xml filename, it will update record in Koha.
This script is intentionally separate from Koha itself and dependencies which Koha has under assumption that you might want to run it on another machine (or create custom script which mungles Koha's records from other machine without bringing all Koha dependencies with it).
This same script can be used as module (as it defines Koha::SVC package) using
require "koha-svc.pl"
at beginning of script. Rest of API is described below. Example of its usage is at beginning of this script.
my $svc = Koha::SVC->new( url => 'http://koha-dev:8080/cgi-bin/koha/svc', user => 'svc-user', password => 'svc-password', debug => 0, );
URL must point to Koha's intranet address and port.
Specified user must have editcatalogue
permission.
my $marcxml = $svc->get( $biblionumber );
my $marcxml = $svc->post( $biblionumber, $marcxml );
Hey! The above document had some coding errors, which are explained below:
Deleting unknown formatting code T<>