The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Museum::Rijksmuseum::Object - Access the Rijksmuseum object metadata API

VERSION

Version 0.03

SYNOPSIS

Access the collection, collection details, and collection image endpoints of the Rijksmuseum "Rijksdata" API.

    use Museum::Rijksmuseum::Object;

    my $api           = Museum::Rijksmuseum::Object->new( key => 'abc123xyz', culture => 'en' );
    my $search_result = $api->search( involvedMaker => 'Rembrandt van Rijn' );
    die $search_result->{error} if $search_result->{error};
    print "Results: $search_result->{count}\n";
    for my $item ( $search_result->{artObjects}->@* ) {
        print "Id: $item->{id}\n";
    }

Refer to the Rijksmuseum API documentation for information on query and response formats. Be aware that the API expects camelCase on its parameters and this module follows this convention.

SUBROUTINES/METHODS

new

    my $api = Museum::Rijksmuseum::Object->new(
        key     => 'abc123xyz',    # the API key supplied by the Rijksmuseum
        culture => 'en',           # the 'culture' parameter, determines the
                                   # language for searching and results
    );

Creates a new object instance. The key and culture parameters are required.

    my $result = $api->search(
        p       => 3,            # page 3
        ps      => 10,           # 10 results per page
        q       => 'vermeer',    # a general search term
        imgonly => 1,            # image only?
    );

Searches the collection. See the API documentation for parameter details.

fetch

    my $result = $api->fetch('SK-C-5');

Fetches an individual item from the collection. The parameter is the objectNumber as returned by the search call.

image_info

    my $result = $api->image_info('SK-C-5');

Fetches the information required to build the image tiles for a particular objectNumber.

ATTRIBUTES

key

The API key provided by the Rijksmuseum.

culture

The 'culture' that the API will return data to you in, and perform searches in. Typically 'en' or 'nl'.

SEE ALSO

For bulk-ingestion of data using the Rijksmuseum OAI-PMH API, see Museum::Rijksmuseum::Object::Harvester.

AUTHOR

Robin Sheat, <rsheat at cpan.org>

TODO

Make a heavier interface

At the moment this is a very thin interface over the Rijksmuseum API. It could be improved by having helpers to do things, for example optionally automatically fetching and stitching images.

BUGS

Please report any bugs or feature requests to bug-museum-rijksmuseum-object at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Museum-Rijksmuseum-Object. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Alternately, use the tracker on the repository page at https://gitlab.com/eythian/museum-rijksmuseum-object.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Museum::Rijksmuseum::Object

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by Robin Sheat.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)