Schema Documentation
mediaItem
Description
An object of the mediaItem Type.
Response
Returns a MediaItem
Arguments
Name | Description |
---|---|
id - ID! | The globally unique identifier of the object. |
idType - MediaItemIdType | Type of unique identifier to fetch by. Default is Global ID |
asPreview - Boolean | Whether to return the Preview Node instead of the Published Node. When the ID of a Node is provided along with asPreview being set to true, the preview node with un-published changes will be returned instead of the published node. If no preview node exists or the requestor doesn't have proper capabilities to preview, no node will be returned. |
Example
Query
query mediaItem( $id: ID!, $idType: MediaItemIdType,$asPreview: Boolean){ mediaItem( id: $id, idType: $idType, asPreview: $asPreview ){ altTextancestors { ...HierarchicalContentNodeToContentNodeAncestorsConnectionFragment }author { ...NodeWithAuthorToUserConnectionEdgeFragment }authorDatabaseIdauthorIdcaptionchildren { ...HierarchicalContentNodeToContentNodeChildrenConnectionFragment }commentCountcommentStatuscomments { ...MediaItemToCommentConnectionFragment }contentType { ...ContentNodeToContentTypeConnectionEdgeFragment }contentTypeNamedatabaseIddatedateGmtdescriptiondesiredSlugeditingLockedBy { ...ContentNodeToEditLockConnectionEdgeFragment }enclosureenqueuedScripts { ...ContentNodeToEnqueuedScriptConnectionFragment }enqueuedStylesheets { ...ContentNodeToEnqueuedStylesheetConnectionFragment }fileSizeguididisContentNodeisPreviewisRestrictedisTermNodelastEditedBy { ...ContentNodeToEditLastConnectionEdgeFragment }linkmediaDetails { ...MediaDetailsFragment }mediaItemIdmediaItemUrlmediaTypemimeTypemodifiedmodifiedGmtparent { ...HierarchicalContentNodeToParentContentNodeConnectionEdgeFragment }parentDatabaseIdparentIdpreviewRevisionDatabaseIdpreviewRevisionIdseo { ...PostTypeSEOFragment }sizesslugsourceUrlsrcSetstatustemplate { ...ContentTemplateFragment }titleuri }}
Variables
{"id":"4","idType":"DATABASE_ID","asPreview":false}
Response
{"data":{"mediaItem":{"altText":"xyz789","ancestors":HierarchicalContentNodeToContentNodeAncestorsConnection,"author":NodeWithAuthorToUserConnectionEdge,"authorDatabaseId":123,"authorId":"4","caption":"abc123","children":HierarchicalContentNodeToContentNodeChildrenConnection,"commentCount":123,"commentStatus":"abc123","comments":MediaItemToCommentConnection,"contentType":ContentNodeToContentTypeConnectionEdge,"contentTypeName":"xyz789","databaseId":987,"date":"abc123","dateGmt":"abc123","description":"abc123","desiredSlug":"abc123","editingLockedBy":ContentNodeToEditLockConnectionEdge,"enclosure":"abc123","enqueuedScripts":ContentNodeToEnqueuedScriptConnection,"enqueuedStylesheets":ContentNodeToEnqueuedStylesheetConnection,"fileSize":123,"guid":"xyz789","id":4,"isContentNode":true,"isPreview":false,"isRestricted":false,"isTermNode":true,"lastEditedBy":ContentNodeToEditLastConnectionEdge,"link":"xyz789","mediaDetails":MediaDetails,"mediaItemId":987,"mediaItemUrl":"abc123","mediaType":"xyz789","mimeType":"xyz789","modified":"abc123","modifiedGmt":"abc123","parent":HierarchicalContentNodeToParentContentNodeConnectionEdge,"parentDatabaseId":123,"parentId":4,"previewRevisionDatabaseId":987,"previewRevisionId":"4","seo":PostTypeSEO,"sizes":"abc123","slug":"xyz789","sourceUrl":"xyz789","srcSet":"abc123","status":"xyz789","template":ContentTemplate,"title":"xyz789","uri":"abc123"}}}