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::MetropolitanMuseumArt - A simple interface to the Metropolitan Museum of Art's API

VERSION

Version 0.03

SYNOPSIS

Provides access to the object-related endpoints from the Metropolitan Museum's API. See https://metmuseum.github.io/#objects for the API information.

    use Museum::MetropolitanMuseumArt;

    my $m = Museum::MetropolitanMuseumArt->new();
    # Returns an arrayref of IDs. Dies if there's an error.
    my $new_objects->$m->get_objects(date => '2023-01-01');
    if (@$new_objects) {
        # A hashref containing the object data
        my $object = $m->get_object($new_objects->[0]);
        say $object->{title};
    }

Note: The Met Museum requests a rate-limit of 80 requests per second, please stick to that.

METHODS

get_objects

Gets a list of all or a subset of object IDs from the API. Note that this can be a fair bit of data (nearly half a million entries at the time of writing.)

Return a hashref.

Parameters:

date

Corresponds to metadataDate in the API.

departments

An arrayref of department IDs to restrict the results to.

Dies if something goes wrong.

get_object

Fetches the object detail, the only parameter is the object ID.

AUTHOR

Robin Sheat, <rsheat at cpan.org>

BUGS

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

TODO

This only supports the endpoints that I immediately needed, there are a few others (in particular search) that aren't currently supported.

SUPPORT

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

    perldoc Museum::MetropolitanMuseumArt

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 GNU Affero General Public License, Version 3, November 2007