Headless Server Developer Manual / Version 2307
Table Of Contents
The following GraphQL query is a simple example for fetching data
from a CMArticle content item. It is based on the GraphQL schema defined
in the file schema.graphql
:
query ArticleQuery { content { article(id: "2910") { title teaserTitle teaserText picture { name creationDate alt uriTemplate(imageFormat: JPG) } } } }
Of course, you will have to change the article id parameter to a value which is valid in your content server.
Note that the query includes a field called uriTemplate that can be used by a client to construct a URL to the cropped image data by substituting the cropName and width parameters. The file name section at the end of uriTemplate is optional and only for SEO purpose.
The parameter imageFormat
ist optional. By providing a supported image format (jpeg, png or gif), the
url is calculated to trigger the corresponding image transformation on the media endpoint. Note, that in this case
the trailing part of the url which contains the filename, is of course not optional anymore.