Artists’ Materials via the Brooklyn Museum API
From the Brooklyn Museum Collection

From the Brooklyn Museum Collection

For Programming A to Z last week, Adam asked us to get some XML from a web service and use it as input into one of our previous programs. I chose to work with the Brooklyn Museum’s API. In looking through an XML sample from their site, I was intrigued by the variety of artists’ materials listed under each object’s “medium” attribute. When I look at art in museum’s I’m often left guessing by the signage, wondering what process the artist used in order to get a material to behave in a specific way. So, I thought it would be interesting to reduce a description of a work to the media used to create it, then compile a new work out of images of those media (e.g. a work made of glass and walnut transformed and remade with images tagged “glass” and “walnut”). My code for getting the artist and materials data out of the XML returned by a keyword search is here:

import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import java.util.List;
import java.util.HashMap;

public class BrookMuse {

public static void main(String[] args) throws Exception {

String keyword = args[0];

SAXReader reader = new SAXReader();
EasyHTTPGet getter = new EasyHTTPGet(
“[API KEY]&keyword=” + keyword

Document document =;
List works = document.selectNodes(“//items/object”);

for (Object o: works) {
Element work = (Element)o;

List artists = work.selectNodes(“artists/artist”);

if (artists.size() > 0) {
Element firstArtist = (Element)artists.get(0);
String artist = firstArtist.attributeValue(“name”);
String medium = work.attributeValue(“medium”);
System.out.println(artist + “: ” + medium);

String medium = work.attributeValue(“medium”);
System.out.println(“Unknown: ” + medium);

It returns a list that looks ike this (e.g. with search term “noguchi”):

Unknown: Low fired earthenware pottery, reassembled from fragments
Isamu Noguchi: Terracotta, plaster
Isamu Noguchi: Glass, walnut
Isamu Noguchi: Bakelite plastic

Now on to gathering some images…

One Response to Artists’ Materials via the Brooklyn Museum API

  1. Pingback: Design for interactive and social media » Museum Links

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>