Query a specific media item via GraphQL

Hi,

Related to this post which relates to querying all media items. My question is how can I query a specific media item and not all of them. I have tried:

query MediaQuery ($id: ItemId) {
  upload(filter: {id: {eq: $id}}) {
    id
    responsiveImage {
      src
    }
  }
}

The problem is I get back the message ItemId isn't a defined input type (on $id) from Dato.

Is there an obvious mistake here I am blindly missing? Is the input type incorrect?

Appreciate any help with this!

As soon as I post this I find the answer… ItemId is UploadId when querying media items :man_facepalming:

My bad.

Hopefully this gets some SEO and saves someone else time in the future when Google-ing :joy:

1 Like