Skip to content

idmgroup/DSpace-REST-Client-Perl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSpace::REST::Client

Build Status Coverage Status

Perl REST Client for DSpace

Description

This is a REST client which is dealing with the authentication token automatically. It is based on REST::Client;

Usage

use DSpace::REST;

# create a new client for the latest released version of dspace
my $dspace = DSpace::REST->new(
    'host' => 'https://demo.dspace.org/rest'
);

# self signed certificate
my $ua = $dspace->client->getUseragent();
$ua->ssl_opts(SSL_fingerprint => 'sha256$9d9f9e072e4edfd6b0a16f87229f2634cc0c480d201272c0ba7b8a0b7defacad');

# log in (the token will be remembered)
$dspace->login(
    entity => {
        email => '********',
        password => '********'
    },
    headers => {
        'Content-Type' => 'application/json'
    }
);

# list the communities
my $slice = $dspace->get_communities(
    limit => 20,
    offset => 0,
    headers => {
        'Accept' => 'application/json'
    }
);

foreach my $com (@$slice) {
    print $com->{name}."\n";
}

# create a new client for a specific version of dspace
my $dspace_v5 = DSpace::REST->new(
    'dspace_version' => 5.3,
    'host' => 'https://demo.dspace.org/rest'
);

Build hints

Update WADL

Get it from a running DSpace instance and put it in the res directory.

Regenerate Client.pm

$ ./bin/wadl2perl.pl res/dspace-5_x/application.wadl res/dspace-5_x/Client.pm.tt >| lib/DSpace/REST/ClientV5.pm
$ ./bin/wadl2perl.pl res/master/application.wadl res/master/Client.pm.tt >| lib/DSpace/REST/ClientV6.pm

Releases

No releases published

Packages

No packages published

Languages