0
votes

I'm working to replace a headless Wordpress installation being used as a backend with Strapi/GraphQL. Because the Media Library is a new feature for Strapi, I'm unable to find any documentation on how to achieve what I'm needing (also my very basic understanding of GraphQL is more than likely a factor.)

Essentially I've got a Content Type of Image. An Image has a name, description and image from the Media Library attached to it (called src). If I visit the /upload/files endpoint, I can see several different size variations underneath the key of formats. I would like access to those formats from a GraphQL query. How would I go about creating a query like this?

{
  galleries {
    id
    name
    cover_image {
      url
    }
    images {
      id
      name
      description
      src {
        url        <--- comes from Cloudinary URL. I would like formats within the image object
      }
    }
  }
}
1

1 Answers

0
votes

I must've just needed a restart, because when I looked at the schema it showed me how to include the formats I wanted. My new query looks something like this:

galleries {
    id
    name

    images {
      id
      name
      slug
      description
      price
      src {
        url
        formats            <--- here's what I was looking for
      }
    }
  }