NAME

ELab::Client - Access the eLabFTW API with Perl

VERSION

version 0.010

SYNOPSYS

use ELab::Client;

my $elab = ELab::Client->new(
      host => 'https://elab.somewhere.de/',
      token => 'ae...d4',
);

my $e = $elab->post_experiment(4,
                  title => "New experiment title",
                  body => "The new body text"
      );

This module is work in progress, and coverage of the API is by far not complete yet.

METHODS

create_experiment

Creates a new experiment:

my $e = $elab->create_experiment();

The return value is a hash reference with fields

result      string       'success' or error message
id          string       id of the new experiment

create_item

Creates a new database item of type $type:

my $e = $elab->create_item($type);

The return value is a hash reference with fields

result      string       'success' or error message
id          string       id of the new item

create_template

Creates a new template:

my $t = $elab->create_template();

The return value is a hash reference with fields

result      string       'success' or error message
id          string       id of the new template

get_all_experiments

Lists experiments, with maximum number limit and starting at offset.

my $a = $elab->get_all_experiments(limit => 15, offset => 0);

The return value is an array reference, where each element is a hash reference describing an experiment (not fully, but abbreviated).

get_experiment

Returns an experiment.

my $e = $elab->get_experiment($id);

The return value is a hash reference with the full experiment information.

get_all_items

Lists database items, with maximum number limit and starting at offset.

my $a = $elab->get_all_items(limit => 25, offset => 0);

The return value is an array reference, where each element is a hash reference corresponding to a database item.

get_item

Returns a database item.

my $i = $elab->get_item($id);

get_items_types

Returns a list of database item types.

my $t = $elab->get_items_types();

The return value is an array reference ...

get_tags

Returns the tags of the team.

my $t = $elab->get_tags();

get_upload

Get an uploaded file from its id

my $data = $elab->get_upload($id);

The result is the raw binary data of the uploaded file.

get_status

Get a list of possible experiment states (statuses?)...

my $s = $elab->get_status();

get_all_templates

my $t = $elab->get_all_templates();

get_template

my $t = $elab->get_template($id);

post_experiment

my $e = $elab->post_experiment(13,
                  title => "Updated experiment title",
                  body => "Updated experiment body text"
      );

post_item

my $i = $elab->post_item(4,
                  title => "Database item",
                  body => "here are the bodies"
      );

post_template

AUTHOR

Andreas K. Huettel <dilfridge@gentoo.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Andreas K. Huettel.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.