close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2207

Table Of Contents

4.10.1 Simple Article Query

The following GraphQL query is a simple example for fetching data from a CMArticle document. 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.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.