Nested Inline RTE references in AEM GraphQL | Adobe Higher Education
Skip to main content
Level 2
December 5, 2024
Besvarat

Nested Inline RTE references in AEM GraphQL

  • December 5, 2024
  • 2 svar
  • 579 visningar

Im working with AEM content fragments and trying to fetch the data using GraphQL.

Below is my query -

{
  productByPath(_path: "/content/dam/my/product", variation:"master") {
    item {
      productDescription {
        html
      }
    }
    _references {
      ... on DisclaimerModel {
        productDisclaimer {
          html
        }
      }
      ... on DiscountModel {
        _path
        discountPercent
      }
      ... on AbnModel {
        _path
        abn
      }
    }
  }
}

 

I am trying to fetch all content fragment references from the productDescription RTE of the product content fragment. The query works fine and I am able to fetch the references.

Now the productDisclaimer is also an RTE and contains references to other content fragments that I want to fetch. If there a way to nest _references ? 

 

Bästa svar av TarunKumar

HI @architar2 ,

You can try to take reference from below query,illustrates filtering for any person of name “Smith”, returning information from across two nested fragments - company and employee.

 

query { companyList(filter: { employees: { _match: { name: { _expressions: [ { value: "Smith" } ] } } } }) { items { name ceo { name firstName } employees { name firstName } } } }

 

For more details on it, look into below link:
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/graphql-api/sample-queries#sample-companies-employee-smith

 

 

-Tarun

2 svar

TarunKumar
Community Advisor
Community Advisor
December 6, 2024

HI @architar2 ,

You can try to take reference from below query,illustrates filtering for any person of name “Smith”, returning information from across two nested fragments - company and employee.

 

query { companyList(filter: { employees: { _match: { name: { _expressions: [ { value: "Smith" } ] } } } }) { items { name ceo { name firstName } employees { name firstName } } } }

 

For more details on it, look into below link:
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/graphql-api/sample-queries#sample-companies-employee-smith

 

 

-Tarun

kautuk_sahni
Community Manager
Community Manager
February 18, 2025

@architar2 Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!

Kautuk Sahni