These are examples of queries to fetch and mutate media data.
A media item, with the image source in different sizes:
All media items (with mime type "image" by default), and all the image sizes:
The posts' featured image:
Filtering media items:
Fetching video and audio items:
Fields myMediaItemCount
, myMediaItems
and myMediaItem
fetch the logged-in user's media items:
We can reference any image existing in the Media library.
With nested mutations:
Passing the URL:
Passing directly the contents of the attachment:
Creating a media item reusing the attached file from another media item:
Changing the alternative text and caption of an image: