Collections: API: Responses

  • 1st Floor
    Arts of Africa, Steinberg Family Sculpture Garden
  • 2nd Floor
    Arts of Asia and the Islamic World
  • 3rd Floor
    Egyptian Art, European Paintings
  • 4th Floor
    Contemporary Art, Decorative Arts, Elizabeth A. Sackler Center for Feminist Art
  • 5th Floor
    Luce Center for American Art

On View: Table

Today when we think of where inventive contemporary design is manufactured, we often think of Italy. This, however, was not always the c...

Hiroshige's One Hundred Famous Views of Edo

Hiroshige's 118 woodblock landscape and genre scenes of mid-nineteenth-century Tokyo, is one of the greatest achievements of Japanese art.

    On View: Table

    Today when we think of where inventive contemporary design is manufactured, we often think of Italy. This, however, was not always the c...

     

    Login to play

    Login with Google ID

    Forgot your password?

    Not a Posse member? Register

    Brooklyn Museum Posse:
    Exploring the collection

    When you join the posse, your tags comments and favorites will display with your attribution and save to your profile.

    Three response formats are supported. The format returned is determined by the optional format parameter you use (default xml). The top-level data type returned by all responses is the RESPONSE element.

    XML

    Arguably the most flexible format, XML responses follow this basic template:

    <?xml version="1.0" ?>
    <response status="success">
      [XML Payload]
    </response>
    

    The format of the 'XML Payload' is defined by the method called. The following demonstrates a simple collection.search response:

    <?xml version="1.0" ?>
    <response status="success" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.brooklynmuseum.org/opencollection/api/api.xsd">
      <resultset total="19" start_index="0" results_limit="2" query="keyword=eames" next_uri="http://www.brooklynmuseum.org/opencollection/api/?method=collection.search&version=1&api_key=&format=xml&include_item_fields=true&include_image_caption=false&results_limit=2&keyword=eames&_local_access_key=fcbd320e369dc0b9b2de3a4d8120c3901236219324&start_index=2">
        <items>
          <object id="1677" title="Leg Splint" uri="http://www.brooklynmuseum.org/opencollection/objects/1677/Leg_Splint" accession_number="83.156" object_date="designed 1941-1942; manufactured 1943-1945" object_date_begin="1941" object_date_end="1945" medium="Plywood" dimensions="42 x 4 1/4 x 8 in. (106.7 x 10.8 x 20.3 cm)" markings="Branded on inside section behind ankle: "S2-1790"; stamped in green on outside near top: "MOLDED PLYWOOD DIVISION / LOS ANGELES CALIFORNIA / patent pending [...] EAMES [...]"; circular logo containing "EVANS PRODUCTS COMPANY" around circle, and crisscrossing in center: "EVANS / EVANS"" signed="no signature" inscribed="no inscriptions" credit_line="Anonymous gift" classification="Medical" rank="0">
            <images total="2">
              <image uri="http://www.brooklynmuseum.org/opencollection/images/objects/size2/83.156_transp2760.jpg" thumb_uri="http://www.brooklynmuseum.org/opencollection/images/objects/size0/83.156_transp2760.jpg" credit="Brooklyn Museum photograph" description="overall" is_color="true" rank="0"/>
            </images>
            <artists>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/8699/Charles_Eames" id="8699" name="Charles Eames" dates="American, 1907-1978" nationality="American" role="Designer"/>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/6823/Ray_Eames" id="6823" name="Ray Eames" dates="American, born Bernice Alexander Kaiser, 1912-1988" nationality="American" role="Designer"/>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/14333/Evans_Products_Company" id="14333" name="Evans Products Company" dates="" nationality="" role="Manufacturer"/>
            </artists>
          </object>
          <object id="2103" title="Storage Unit" uri="http://www.brooklynmuseum.org/opencollection/objects/2103/Storage_Unit" accession_number="1992.7" object_date="1948-1954" object_date_begin="1948" object_date_end="1954" medium="Birch plywood, masonite, black plastic laminate veneer, chrome-plated steel, white metal, rubber" dimensions="Overall:  58 1/2 x 46 7/8 x 16 7/8 in. (148.6 x 119.0 x 42.9 cm)
    Drawers: 3 1/2 x 22 1/4 x 16 3/8 in. ( 9 x 56.5 x 41 5 cm); without drawer handle, depth: 15 5/8 in. ( 39.7 cm)" markings="no marks" signed="no signature" inscribed="no inscription" credit_line="Marie Bernice Bitzer Fund" classification="Furniture" rank="1">
            <images total="2">
              <image uri="http://www.brooklynmuseum.org/opencollection/images/objects/size2/1992.7_transp504.jpg" thumb_uri="http://www.brooklynmuseum.org/opencollection/images/objects/size0/1992.7_transp504.jpg" credit="Brooklyn Museum photograph" description="overall" is_color="true" rank="0"/>
            </images>
            <artists>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/8699/Charles_Eames" id="8699" name="Charles Eames" dates="American, 1907-1978" nationality="American" role="Designer"/>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/6823/Ray_Eames" id="6823" name="Ray Eames" dates="American, born Bernice Alexander Kaiser, 1912-1988" nationality="American" role="Designer"/>
              <artist uri="http://www.brooklynmuseum.org/opencollection/artists/14332/The_Herman_Miller_Company" id="14332" name="The Herman Miller Company" dates="established 1923" nationality="American" role="Manufacturer"/>
            </artists>
          </object>
        </items>
      </resultset>
    </response>

    Errors in XML responses look like this:

    <?xml version="1.0" ?>
    <response status="fail" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.brooklynmuseum.org/opencollection/api/api.xsd">
      <error code="1001" message="Missing parameter. Must provide a keyword or date range."/>
    </response>

    Note that in addition to the Brooklyn Museum API metadata format implied in the responses above we, also support CDWA-Lite and Dublin Core if you're into those kinds of things.

    JSON

    JSON may be favored over XML if you intend to call on Collection API services using JavaScript (or another ECMA based scripting language). JSON response envelopes follow this basic template:

    {
      "response": {
        [JSON Payload]
        "status": "success"
      }
    }
    

    The format of the 'JSON Payload' is defined by the method called. The following demonstrates a simple collection.search response (identical to the query above):

    {
      "response": {
        "resultset": {
          "total": 19,
          "start_index": 0,
          "results_limit": 2,
          "query": "keyword=eames",
          "items": [
            {
              "type": "object",
              "id": "1677",
              "title": "Leg Splint",
              "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/objects\/1677\/Leg_Splint",
              "images": {
                "total": "2",
                "0": {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/images\/objects\/size2\/83.156_transp2760.jpg",
                  "thumb_uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/images\/objects\/size0\/83.156_transp2760.jpg",
                  "credit": "Brooklyn Museum photograph",
                  "description": "overall",
                  "is_color": true,
                  "rank": 0
                }
              },
              "accession_number": "83.156",
              "object_date": "designed 1941-1942; manufactured 1943-1945",
              "object_date_begin": "1941",
              "object_date_end": "1945",
              "medium": "Plywood",
              "dimensions": "42 x 4 1\/4 x 8 in. (106.7 x 10.8 x 20.3 cm)",
              "markings": "Branded on inside section behind ankle: \"S2-1790\"; stamped in green on outside near top: \"MOLDED PLYWOOD DIVISION \/ LOS ANGELES CALIFORNIA \/ patent pending [...] EAMES [...]\"; circular logo containing \"EVANS PRODUCTS COMPANY\" around circle, and crisscrossing in center: \"EVANS \/ EVANS\"",
              "signed": "no signature",
              "inscribed": "no inscriptions",
              "credit_line": "Anonymous gift",
              "classification": "Medical",
              "artists": [
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/8699\/Charles_Eames",
                  "id": "8699",
                  "name": "Charles Eames",
                  "dates": "American, 1907-1978",
                  "nationality": "American",
                  "role": "Designer",
                  "type": "artist"
                },
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/6823\/Ray_Eames",
                  "id": "6823",
                  "name": "Ray Eames",
                  "dates": "American, born Bernice Alexander Kaiser, 1912-1988",
                  "nationality": "American",
                  "role": "Designer",
                  "type": "artist"
                },
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/14333\/Evans_Products_Company",
                  "id": "14333",
                  "name": "Evans Products Company",
                  "dates": null,
                  "nationality": null,
                  "role": "Manufacturer",
                  "type": "artist"
                }
              ],
              "rank": 0
            },
            {
              "type": "object",
              "id": "2103",
              "title": "Storage Unit",
              "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/objects\/2103\/Storage_Unit",
              "images": {
                "total": "2",
                "0": {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/images\/objects\/size2\/1992.7_transp504.jpg",
                  "thumb_uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/images\/objects\/size0\/1992.7_transp504.jpg",
                  "credit": "Brooklyn Museum photograph",
                  "description": "overall",
                  "is_color": true,
                  "rank": 0
                }
              },
              "accession_number": "1992.7",
              "object_date": "1948-1954",
              "object_date_begin": "1948",
              "object_date_end": "1954",
              "medium": "Birch plywood, masonite, black plastic laminate veneer, chrome-plated steel, white metal, rubber",
              "dimensions": "Overall:  58 1\/2 x 46 7\/8 x 16 7\/8 in. (148.6 x 119.0 x 42.9 cm)\r\nDrawers: 3 1\/2 x 22 1\/4 x 16 3\/8 in. ( 9 x 56.5 x 41 5 cm); without drawer handle, depth: 15 5\/8 in. ( 39.7 cm)",
              "markings": "no marks",
              "signed": "no signature",
              "inscribed": "no inscription",
              "credit_line": "Marie Bernice Bitzer Fund",
              "classification": "Furniture",
              "artists": [
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/8699\/Charles_Eames",
                  "id": "8699",
                  "name": "Charles Eames",
                  "dates": "American, 1907-1978",
                  "nationality": "American",
                  "role": "Designer",
                  "type": "artist"
                },
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/6823\/Ray_Eames",
                  "id": "6823",
                  "name": "Ray Eames",
                  "dates": "American, born Bernice Alexander Kaiser, 1912-1988",
                  "nationality": "American",
                  "role": "Designer",
                  "type": "artist"
                },
                {
                  "uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/artists\/14332\/The_Herman_Miller_Company",
                  "id": "14332",
                  "name": "The Herman Miller Company",
                  "dates": "established 1923",
                  "nationality": "American",
                  "role": "Manufacturer",
                  "type": "artist"
                }
              ],
              "rank": 1
            }
          ],
          "next_uri": "http:\/\/www.brooklynmuseum.org\/opencollection\/api\/?method=collection.search&version=1&api_key=&format=json&include_item_fields=true&include_image_caption=false&results_limit=2&keyword=eames&_local_access_key=e119d07b7d17079ddbb27f57c7cf523e1236219328&start_index=2"
        },
        "status": "success"
      }
    }

    Errors in JSON responses look like this:

    {
      "response": {
        "status": "fail",
        "error": {
          "code": 1001,
          "message": "Missing parameter. Must provide a keyword or date range."
        }
      }
    }

    HTML

    If you don't plan on working with the data at a granular level and just want a preformatted block of HTML that you can immediately insert into a Web page, HTML is your format. HTML response envelopes follow this basic template:

    <!-- BM:status="success" -->
    [HTML Payload]
    

    As with other formats, the format of the 'HTML Payload' is defined by the method called. The following demonstrates a simple collection.search response (identical to the query above):

    <!-- BM:status=success -->
      <style type="text/css">
      div.bm-content { font-family:sans-serif; font-size:0.8em; }
      p.bm-pagination a { margin-left:2em; }
      a img { border: none; }
      ul.bm-results { list-style:none; }
      ul.bm-results { display:block; }
      ul.bm-results li { background-color:#EEE; padding:0.5em; margin:0.5em; float:left; width:16em; height:10em; }
      ul.bm-results li img { float:right; width:auto; margin-left:0.2em; }
      span.bm-item-title, span.bm-item-artists, span.bm-item-date { display:block; margin-bottom:0.1em; }
      span.bm-item-title { font-weight:bold; }
      span.bm-artist-dates { display:block; color: gray; }
      span.bm-artist-thumbs { color: gray; }
      span.bm-image-caption { display:block; margin:0.5em 0; color:gray; }
      span.bm-clear { display:block; clear:both; }
      </style>
    <div class="bm-content">
    <p class="bm-showing">Showing items 1 - 2 of 19</p>
    <p class="bm-pagination"><a href="http://www.brooklynmuseum.org/opencollection/api/?method=collection.search&version=1&api_key=&format=html&include_item_fields=true&include_image_caption=false&results_limit=2&keyword=eames&_local_access_key=b85d2ab6ace2650b76430da5b94ad7781236219331&start_index=2">Next</a>
    <ul class="bm-results">
    <li>
      <span class="bm-object">
      <a href="http://www.brooklynmuseum.org/opencollection/objects/1677/Leg_Splint" rel="bm"><span class="bm-item-title">Leg Splint</span></a>
      <span class="bm-item-artists">Charles Eames; Ray Eames; Evans Products Company</span>
      <span class="bm-item-date">designed 1941-1942; manufactured 1943-1945</span>
      <span class="bm-clear"></span>
      </span>
    </li>
    <li>
      <span class="bm-object">
      <a href="http://www.brooklynmuseum.org/opencollection/objects/2103/Storage_Unit" rel="bm"><span class="bm-item-title">Storage Unit</span></a>
      <span class="bm-item-artists">Charles Eames; Ray Eames; The Herman Miller Company</span>
      <span class="bm-item-date">1948-1954</span>
      <span class="bm-clear"></span>
      </span>
    </li>
    </ul>
    </div>

    Errors in HTML responses look like this:

    <!-- BM:status=fail -->
    <p class="bm-error">Error 1001: Missing parameter. Must provide a keyword or date range.</p>
    Reference