API Documentation
Your API Token
Below is your API developer token, this is the token you'll use to sign all your API calls. Always try to keep your token private and out of public GitHub repositories.
The M+ API Endpoint
Below is the GraphQL endpoint which you'll be making your API calls against. See below for more details on how to structure calls.
https://api.mplus.org.hk/graphql
How to Use the M+ API
The M+ API is built on GraphQL, an open-source data query language. You'll use GraphQL to request information from the M+ data set.
Traditionally GraphQL allows two types of operations: queries and mutations. These can be thought of as read and write operations. There is also one more operation called introspection, which allows you to ask the GraphQL endpoint about itself.
M+ API Playground
The easiest way to try out M+ API queries is to use the playground, which can be found here: https://api.mplus.org.hk//playground
To see an example, click the below link. You will need to press the ‘run’ button to see the results of the query. Run in the playground
How to Communicate with the M+ API
Here, you will find examples of various calls that you can make to the GraphQL endpoint. The single endpoint for all API calls is...
https://api.mplus.org.hk/graphql
GraphQL operations consist of multiline JSON. An example ‘Hello World’ GraphQL query is shown below:
query { hello }
To query GraphQL using cURL, make a POST
request with a JSON payload as --data-binary
. You must also include your API token as bearer
authorisation.
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ hello \ }\"}" \ https://api.mplus.org.hk/graphql
To query using Nodejs, make sure to pass in your API token as a bearer
token as shown below:
const request = require('request') const payload = { query: `{ hello }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
M+ API Queries
Below, you'll find a list of the current queries you can make through the M+ API.
Introspection
The introspection operation is the only operation you can call using GET
. Introspection allows you to query the M+ API schema for details about itself. Query __schema
to list all types defined in the schema and get details about each:
query { __schema { types { description fields { args { name type { name } defaultValue } description name type { name } } kind name } } }
Filtering the Queries
You can filter the M+ API queries in a few ways. The valid filters for many of these queries are page
, per_page
, lang
, sort
and sort_field
. Valid values for the sort_field
are title
and count
. Valid values for the sort
are asc
and desc
.
The per_page
filter will limit the number of results, for example (per_page: 10)
will return just 10 records. Unlike Objects you cannot paginate through this data set.
If there are more valid filters and values for a particular query, they will be noted in the corresponding sections below.
Objects
Objects refer to individual artworks, moving image pieces and other works in the M+ Collections.
This query selects all objects, and can be filtered through certain fields, as shown below. Note: filters are additive rather than or, and filtering two fields will only return records that match both.
Valid filters are: page
, per_page
, [ids]
, lang
, sort
, sort_field
, objectNumber
, area
, category
, archivalLevel
, medium
, title
, displayDate
, beginDate
, endDate
, constituent
, [constituents]
, exhibition
, and keyword
Note: The filters collectionName
, collectionCode
, and collectionType
can be used to differentiate between Collections results and Archives results. These filters are related to the Archives-specific queries.
Valid values for the sort_field
are id
, objectNumber
, sortNumber
, title
, displayDate
, beginDate
, endDate
, popularCount
, area
, medium
, archivalLevel
and category
, values for sort
are asc
and desc
.
The only valid values for lang
are en
and zh-hant
. The default is en, so if a record doesn't have values that match the selected language, it will return the en
version (if there is one).
Here is a simple call to get all object ids
query { objects { id } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ objects { \ id \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ objects { id } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Fetching by ids
You can also ask for specific objects by passing in an array of ids
.
query { objects(ids:[1, 4, 6, 7]) { id objectNumber title displayDate medium classification { area category } } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ objects(ids:[1, 4, 6, 7]) { \ id \ objectNumber \ title \ displayDate \ medium \ classification { \ area \ category \ } \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Querying a single object
You can get a single object by passing in the id
parameter. Here we are showing all the fields possible.
query { object(id: 3000) { id sortNumber publicAccess objectNumber classification { area category archivalLevel } title titleOther displayDate displayDateOther beginDate endDate dimension dimensionDetails { width height depth unit element rank } medium creditLine constituents { id name } images { altText } color { predominant { color value } search { google { color value } cloudinary { color value } } } } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ object(id: 3000) { \ id \ sortNumber \ publicAccess \ objectNumber \ classification { \ area \ category \ archivalLevel \ } \ title \ titleOther \ displayDate \ displayDateOther \ beginDate \ endDate \ dimension \ dimensionDetails { \ width \ height \ depth \ unit \ element \ rank \ } \ medium \ creditLine \ constituents { \ id \ name \ } \ images { \ altText \ } \ color { \ predominant { \ color \ value \ } \ search { \ google { \ color \ value \ } \ cloudinary { \ color \ value \ } \ } \ } \ \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ object(id: 3000) { id sortNumber publicAccess objectNumber classification { area category archivalLevel } title titleOther displayDate displayDateOther beginDate endDate dimension dimensionDetails { width height depth unit element rank } medium creditLine constituents { id name } images { altText } color { predominant { color value } search { google { color value } cloudinary { color value } } } } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Pagination and filtering
Here we are asking for slightly more information, note how we can use the per_page
filter to limit the number of results.
query { objects(page:0, per_page: 5, area: "Moving Image") { id objectNumber title displayDate medium classification { area category } } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ objects(page:0, per_page: 5, area: \\\"Moving Image\\\") { \ id \ objectNumber \ title \ displayDate \ medium \ classification { \ area \ category \ } \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ objects(page:0, per_page: 5, area: "Moving Image") { id objectNumber title displayDate medium classification { area category } } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Sorting
Here is an example of sorting by sortNumber
.
query { objects(sort_field: "sortNumber", sort: "asc") { id publicAccess objectNumber sortNumber title displayDate beginDate endDate dimension creditLine medium classification { area category } } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ objects(sort_field: \\\"sortNumber\\\", sort: \\\"asc\\\") { \ id \ publicAccess \ objectNumber \ sortNumber \ title \ displayDate \ beginDate \ endDate \ dimension \ creditLine \ medium \ classification { \ area \ category \ } \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ objects(sort_field: "sortNumber", sort: "asc") { id publicAccess objectNumber sortNumber title displayDate beginDate endDate dimension creditLine medium classification { area category } } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Filtering/Searching by Colour
If you wish to search for objects by colour, you can do that with the following filters: color
, color_threshold
& color_source
.
There are two colour sources: google
and cloudinary
. The default colour source is Google and includes the following values: gray
, black
, orange
, brown
, white
, yellow
, teal
, blue
, green
, red
, pink
& purple
.
Cloudinary offers a slightly different range of colours, including some more specific values such as: gray
, black
, orange
, brown
, white
, yellow
, teal
, blue
, green
, red
, pink
, purple
, lightblue
, olive
, lime
& cyan
. To use the Cloudinary values, please specify cloudinary
as your color_source
.
Color_threshold
lets you specify the range each colour value has. The default value is 75.0. Valid values float between 0.0 and 100.0. The higher the threshold, the fewer the results. (The higher the threshold, the more prevalent a specific colour is within an image).
You can also ask for predominant
colors in the results, which will return you hex values of the predominant colours. See the example below.
query { objects(color: "orange", color_threshold: 70.0, color_source: "google") { id title color { predominant { color value } search { google { color value } cloudinary { color value } } } } }
Areas
An ‘area’ is a discipline or broader category that objects can fall under, for example visual art, moving image, or design and architecture. To fetch all valid areas, run the following query.
Valid filters are page
, per_page
, lang
, sort
and sort_field
.
Valid values for the sort_field
are title
and count
. Valid values for the sort
are asc
and desc
.
The per_page
filter will limit the number of results, for example (per_page: 10)
will return just ten records. Unlike objects you cannot paginate through this data set.
query { areas(lang: "zh-hant", sort_field: "count", sort: "asc") { title count } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ areas(lang: \\\"zh-hant\\\", sort_field: \\\"count\\\", sort: \\\"asc\\\") { \ title \ count \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ areas(lang: "zh-hant", sort_field: "count", sort: "asc") { title count } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Filtering Objects by Area
To filter objects by area, run an object query with (area: "XXX")
where ‘XXX’ is a specific area id.
Categories
Categories refer to classification of object types, such as painting, furniture, and more. To fetch all the valid categories, run the following query.
query { categories(lang: "zh-hant", sort_field: "count", sort: "desc") { title count } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ categories(lang: \\\"zh-hant\\\", sort_field: \\\"count\\\", sort: \\\"desc\\\") { \ title \ count \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ categories(lang: "zh-hant", sort_field: "count", sort: "desc") { title count } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Filtering Objects by Category
To filter objects by category, run an object query with (category: "XXX")
where ‘XXX’ is a specific category id.
Archival Levels
Archival records have a different classification hierarchy to objects. A group of archival records is called a ‘fond’, while individual objects sit on an ‘item’ level. The hierarchy of archival records is ‘fonds’, ‘sub-fonds’, ‘series’, ‘sub-series’, ‘sub-subseries’, ‘file’, ‘item’, and finally ‘piece’. To fetch all valid archival levels, run the following query.
query { archivalLevels { title count } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ archivalLevels { \ title \ count \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ archivalLevels { title count } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Archival Fonds
Fonds are used to query fonds-level archival records within the M+ Collection Archives. To fetch all valid fonds, run the following query.
query { fonds { title count } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ fonds { \ title \ count \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ fonds { title count } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Below is an example of a query that is calling all of the objects that fall under a specific collection code.
query { objects(fonds: "CA1") { id objectNumber title displayDate medium classification { area category } } }
Mediums
Mediums refer to the materials an object is made of. To fetch all valid mediums, run the following query.
query { mediums { title count } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ mediums { \ title \ count \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ mediums { title count } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Filtering Objects by Medium
To filter objects by medium, run an object query with (medium: "XXX")
where ‘XXX’ is a specific medium id.
Constituents
Constituents are people and organisations connected to an object. For example, constituents may be artists, individual architects, design studios, manufacturers, or publishers.
This query selects all of the constituents and can be filtered by certain fields shown below. Note: filters are additive rather than or, so filtering two fields will only return records that match both.
Valid filters are: page
, per_page
, sort_field
, sort
, [ids]
, gender
, name
, gender
, beginDate
, endDate
, keyword
, isMaker
, role
and lang
Valid values for the sort_field
are id
, name
, sortNumber
, alphaSortName
, gender
, beginDate
, endDate
, objectCount
and nationality
, values for sort
are asc
and desc
.
Here is a simple call to get all constituent ids
query { constituents { id } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituents { \ id \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituents { id } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Fetching by ids
You can also ask for specific constituents by passing in an array of ids
.
query { constituents(ids:[238, 382, 459, 608], lang: "zh-hant") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituents(ids:[238, 382, 459, 608], lang: \\\"zh-hant\\\") { \ id \ name \ nameOther \ alphaSortName \ displayBio \ gender \ beginDate \ nationality \ type \ roles \ isMaker \ objectCountPublic \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituents(ids:[238, 382, 459, 608], lang: "zh-hant") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Constituent Roles
‘Roles’ refers to the types of constituents that are within the dataset. You can get a list of all the constituent roles using the makertypes
query. Note: this data will allow you to filter constituents by a single type in a constituent query.
query { makertypes { title } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ makertypes { \ title \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ makertypes { title } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Fetching by Roles
You can fetch constituents by role. Here is an example of all the ‘Artist’ constituents ordered by number of related objects.
query { constituents(role:"Artist", isMaker:true, sort_field: "objectCountPublic", sort:"desc") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituents(role:\\\"Artist\\\", isMaker:true, sort_field: \\\"objectCountPublic\\\", sort:\\\"desc\\\") { \ id \ name \ nameOther \ alphaSortName \ displayBio \ gender \ beginDate \ nationality \ type \ roles \ isMaker \ objectCountPublic \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituents(role:"Artist", isMaker:true, sort_field: "objectCountPublic", sort:"desc") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Pagination and filtering
Here is an example where more information is being called. Note: we can use the per_page filter to limit the number of results.
query { constituents(page:3, per_page: 5, gender: "Female") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituents(page:3, per_page: 5, gender: \\\"Female\\\") { \ id \ name \ nameOther \ alphaSortName \ displayBio \ gender \ beginDate \ nationality \ type \ roles \ isMaker \ objectCountPublic \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituents(page:3, per_page: 5, gender: "Female") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Sorting
Here is an example of sorting by alphaSortName
.
query { constituents(sort_field: "alphaSortName", sort: "asc") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituents(sort_field: \\\"alphaSortName\\\", sort: \\\"asc\\\") { \ id \ name \ nameOther \ alphaSortName \ displayBio \ gender \ beginDate \ nationality \ type \ roles \ isMaker \ objectCountPublic \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituents(sort_field: "alphaSortName", sort: "asc") { id name nameOther alphaSortName displayBio gender beginDate nationality type roles isMaker objectCountPublic } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Constituent
You can get a single constituent’s information by passing in the id
parameter. Here we are showing all the fields possible.
query { constituent(id: 238) { id name nameOther alphaSortName displayBio gender beginDate nationality roles type objects { id objectNumber title displayDate medium classification { area category } } } }
cURL
curl -H "Authorization: bearer null" \ -H "Content-Type: application/json" \ -X POST -d \ "{\"query\": \ \"{ \ constituent(id: 238) { \ id \ name \ nameOther \ alphaSortName \ displayBio \ gender \ beginDate \ nationality \ roles \ type \ objects { \ id \ objectNumber \ title \ displayDate \ medium \ classification { \ area \ category \ } \ } \ } \ }\"}" \ https://api.mplus.org.hk/graphql
Node.js
const request = require('request') const payload = { query: `{ constituent(id: 238) { id name nameOther alphaSortName displayBio gender beginDate nationality roles type objects { id objectNumber title displayDate medium classification { area category } } } }` } request( { url: 'https://api.mplus.org.hk/graphql', method: 'POST', headers: { 'content-type': 'application/json', Authorization: 'bearer null' }, json: payload }, (error, resp, body) => { if (error) { console.log(error) // do something } if ('errors' in body) { console.log(body.errors) // do something else } console.log(body.data) } )
Nesting Objects in Constituents and Constituents in Objects
When you are searching for objects, you can nest a limited version of constituents in the results. If you are requesting objects, you can get the constituents with the following
query { objects { id objectNumber title displayDate medium classification { area category } constituents { id name alphaSortName displayBio gender beginDate nationality role } } }
If you are requesting a single object, you can retrieve more information about the constituents. See the example below.
query { object(id: 119) { id objectNumber title displayDate medium classification { area category } constituents { id name alphaSortName displayBio gender beginDate nationality role objects { id objectNumber title displayDate medium classification { area category } } } } }
You cannot keep nesting objects and constituents beyond the first two levels, because they would just keep including each other forever.
You can also nest constituents inside objects, but again with limited information returned, and only down two levels.
Finding Objects Related to a Constituent
There are two ways to find objects related to a constituent.
1. To find all the objects created by an artist, run a query to find that artist and request the objects connected to them, as shown below.
query { constituent(id: 478) { id name nameOther alphaSortName displayBio gender beginDate nationality roles type objects { id objectNumber title displayDate medium classification { area category } } } }2. You can also do a search on objects using the constituent
id
as a filter. This method is advantageous because it allows you to filter the results with other filters. The below query shows all objects related to a constituent filtered by specific medium.
query { objects(constituent: 478) { id objectNumber title displayDate medium classification { area category } constituents { name role } } }
Exhibitions
Exhibitions work similarly to constituents. See the following example for how to retrieve all exhibitions within the data set.
query { exhibitions { id beginDate endDate venues { title beginDate endDate } } }
Again, you can also do this via the objects endpoint. Here's an example requesting all objects within a single exhibition in the category of ‘painting’, with ten results shown per page.
query { objects(exhibition:95, per_page:10, page:0, category:"Painting") { id title classification { area category } exhibitions { exhibitions { id beginDate endDate section venues { title beginDate endDate } } labels { text purpose } } constituents { id name nationality gender displayBio exhibitionBios { text purpose } } } }
This will allow you to request all objects for an exhibition. To filter for a single exhibition’s content (for example text labels or artist bios), you will need to utilise the ‘purpose’ label.
Exhibition
If you are interested in a specific exhibition and you know its id, you can request for a single exhibition. See the following example for Mapping Chinese Art, 1972–2012 95
.
query { exhibition(id:95) { id beginDate endDate venues { title beginDate endDate } objects { id title } } }
Text Entries
Text entries refer to supplemental information about objects and exhibitions including purpose, object description, and artist biographies.
To fetch all valid purpose entries, run the following query.
query { exhibition(id: 95) { objects { id title exhibitions { labels { purpose } } } } }
To fetch all valid object descriptions, run the following query.
query { exhibition(id: 95) { objects { id title exhibitions { labels { purpose text } } } } }
To fetch all available artist biographies, run the following query.
query { exhibition(id: 95) { objects { id title constituents { exhibitionBios { purpose text } } } } }