Examples

Lookup Examples

Examples of the JSON sent to the params argument of the Lookup endpoint.

For more information, read about the Lookup endpoint.

Example One

This example is a pretty straightforward use case, where we provide a list of IDs we've already collected (via previous API interactions) and ask for a few components back. As always, the implicit metadata fields for the top-level objects (in this case, our provided Movies) will be returned, along with the components we request:

  • Primary Image
  • Sources
  • Key Traits
{
"ids": [
"mhmov5gKm68VTeNUl3bsEaLz1sspdF0XgpLjtgaubecU",
"mhmovkXnJ3mUXv8QVNfCosjSlFcZoiy5WwNuGga6pifl",
"mhmovD7oNNPQkOlVSwXr35QmUugAp8gq5q0AbR77768g",
"mhmov4BCBVBEKBIF6SKDPPf5bvZLOiAkNgRAbeCsOeWW",
"mhmovHGeXoYoE6XWlxbrjZOd7yAGXADNI4wIOx6oisru",
"mhmovoVXfIShCYPchSDbExCCSYKHzEer7Nld4wXGY5z1",
"mhmovCGlrdV2lM5nqOC9Ae35dEyb4MgwlyfTTY7aUkaJ"
],
"components": [
{ "name": "primaryImage" },
{ "name": "sources" },
{ "name": "keyTraits" }
]
}

Example Two

In this example, we'll use MSIs instead of MHIDs to lookup Content using another Source's IDs (in this case, iTunes). Keep in mind that each client key must be given permission to use an MSI for every individual Source. We also request the components:

  • Primary Image
  • Sources
  • Key Traits
{
"ids": [
"iTunes:Movie:569220589",
"iTunes:Movie:950458760",
"iTunes:Movie:1014360967"
],
"components": [
{ "name": "primaryImage" },
{ "name": "sources" },
{ "name": "keyTraits" }
]
}

Example Three

In this example, we are looking to page within our provided set of IDs and also to use an extra feature wherein we can narrow the specific metadata of each object. We will request:

  • The MHID for the top-level objects.
  • A Thumbnail Component for the Primary Image.
  • A Page Size of 3.
  • Page 1 (the second page for our zero-indexed paging).
{
"ids": [
"mhmov5gKm68VTeNUl3bsEaLz1sspdF0XgpLjtgaubecU",
"mhmovkXnJ3mUXv8QVNfCosjSlFcZoiy5WwNuGga6pifl",
"mhmovD7oNNPQkOlVSwXr35QmUugAp8gq5q0AbR77768g",
"mhmov4BCBVBEKBIF6SKDPPf5bvZLOiAkNgRAbeCsOeWW",
"mhmovHGeXoYoE6XWlxbrjZOd7yAGXADNI4wIOx6oisru",
"mhmovoVXfIShCYPchSDbExCCSYKHzEer7Nld4wXGY5z1",
"mhmovCGlrdV2lM5nqOC9Ae35dEyb4MgwlyfTTY7aUkaJ"
],
"components": [
{
"name": "mhid"
},
{
"name": "primaryImage",
"components": [
{
"name": "thumbnail"
}
]
},
{
"name": "sources"
},
{
"name": "keyTraits"
}
],
"page": 1,
"pageSize": 3
}

Rather than leaving our Components to return their defaulted Components, we have limited our scope to return only the mhid and thumbnail Component for the primaryImage. This slightly reduces the overall payload by eliminating some unnecessary data from the response. Additionally, we have requested page 1 with a pageSize of 3. This will skip the first page (the first three elements) and return the next page (the next three elements) as a response.