Documentation Center

Get a Contentful media asset

Use the externalItem GraphQL query get a single Contentful multimedia asset.

Example request

The first sample code block illustrates a request to retrieve a Contentful media asset based on its identity (entity type is ContentfulAsset).

{
  externalItem(
    identity: {
      namespace: "contentful", 
      type: "ContentfulAsset", 
      id: "1PzXR2apawY8iYM4o0AUoi_Asset_dzb4osfv82yc"
    }) {
    ... on ContentfulAsset {
      title
      contentType
      size
      binaryReference
    }
  }
}

Example response

The second code block illustrates the corresponding response with with the requested asset details.

{
  "data": {
    "externalItem": {
      "title": "Diagram: JSON delivered multi platform",
      "size": 26022,
      "contentType": "image/svg+xml",
      "binaryReference": "http://dxd-staging:8081/
cd/api/external/binary/contentful/
eyJDb250ZW50VHlwZSI6ImltYWdlL3N2Zyt4bWwiLCJFbnRpdHlUeXBlIjoiQXNzZXQifQ%3d%3d/1PzXR2apawY8iYM4o0AUoi_Asset_dzb4osfv82yc"
    }
  }
}