6

I have 2 pages in SDL Tridion:

  1. Template based page ( where page template is "Content Page" ) and
  2. Templateless page (where page template is "Data Publishing page Template").

When I hit query in GraphQL for template based page, It returns JSON in data of rawContent

 ```{
      page(namespaceId: 1, publicationId: 5, pageId: xxx) {
        itemId
        title
        url
        rawContent {
          data
          id
          content
          charSet
        }
      }
    }

but the same query didn't work for templateless page, It returns null in data and content as blank space. Does anyone has clue about how to get JSON for templateless page?

1 Answer 1

6

To fetch the As-is data template less publishing, called “untyped content” from GraphQL:

{
  page(namespaceId: 1, publicationId: 5, pageId: 730)  
  {
    itemId
    title
    url
    content {
      ... on UntypedContent
      {
        data
      }
    }
  }
}

Updated: In Sites 9.5 Templates Data-only publishing, and semantic content models (custom GraphQL Schema).

You have two approaches to consume your published data:

  • As-is called “untyped content”
  • By defining custom semantic models that allow you to map JSON transformations to either change the structure of your content or retrieve only some fields of a JSON data fragment.

Useful references:

Note: AFAIK In Sites 9.6 release automatic semantic models generated based on schemas fields to query individual fields without the need to define custom semantic models.

I hope it helps.

6
  • Isn't there a way to get JSON of templateless like template version? content returns type and id of the page only.
    – Dhara
    Apr 7, 2021 at 12:40
  • updated my answer
    – Velmurugan
    Apr 7, 2021 at 13:11
  • I will look around Semantic Content Modeling, Thank you for your help.!!
    – Dhara
    Apr 8, 2021 at 13:11
  • Where is this mentioned in the documentation, Velu?
    – Quirijn
    Apr 10, 2021 at 8:12
  • 1
    I've summarized the three ways to get content from the CD API in this post on RWS Community. Aug 4 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.