Fetches artwork information from various museum public APIs using object IDs and optionally specifies which fields to return.
Arguments
- object_ids
A vector of artwork object IDs (numeric or character). These identifiers correspond to the unique IDs used in the museum's collection. Cannot be NULL.
- museum
A character string indicating the museum to query. Currently supports:
"artic" - Art Institute of Chicago
"met" - Metropolitan Museum of Art
- fields
An optional vector of field names (character) to return for each artwork. If NULL (default), returns all available fields.
Value
A tibble (data frame) where each row represents one artwork and columns contain the requested fields. The structure varies depending on the requested fields and the museum API.
References
Art Institute of Chicago API: https://api.artic.edu/docs/ Metropolitan Museum of Art API: https://metmuseum.github.io/
Examples
if (FALSE) { # \dontrun{
# Get artwork from Art Institute of Chicago
get_artworks(4, museum = "artic")
# Get artwork from Metropolitan Museum of Art
get_artworks(436535, museum = "met")
# Get multiple artworks with specific fields
get_artworks(c(27992, 28560), museum = "artic",
fields = c("title", "artist_display", "date_display"))
} # }