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 ?
Solved! Go to Solution.
Views
Replies
Total Likes
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...
-Tarun
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...
-Tarun
@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!
Views
Replies
Total Likes