Take the community feedback survey now.
Take the community feedback survey now.
Try using GuidValue or Id for the ContentLink like.
Hi,
Any updates here? I'm having a similar issue with the Strawberryshake client, but still not getting any results when including GuidValue (or Id).
And yes, this works as expected in the GraphiQL editor.
DepartmentPage {
items {
Name
Locations {
ContentLink {
GuidValue
Expanded {
... on LocationPage {
Title
Url
Addresses {
ContentLink {
GuidValue
Expanded {
... on AddressBlock {
AddressLine1
AddressLine2
PostalCode
}
}
}
}
}
}
}
}
}
}
So I did a test against Allloy project for this and I am able to get the correct data. Here are my inputs and responses.
Article page has Main Content aread and a secondary content area. Query below
query ArticlesContentAreaQuery { ArticlePage { items { Name MainContentArea { ContentLink { Expanded { ... on ContactPage { ContentLink{ Id GuidValue } Name } } } } SecondaryContentArea { ContentLink { Expanded { ... on ContactPage { Name ContentLink { Id GuidValue } } } } } } } } |
In the Controller, I have following
var queryResponse = await _contentGraphClient.ArticlesContentAreaQuery.ExecuteAsync();
var mainContentData = queryResponse.Data.ArticlePage.Items.First().MainContentArea.First().ContentLink.Expanded as IArticlesContentAreaQuery_ArticlePage_Items_MainContentArea_ContentLink_Expanded_ContactPage;
var secondaryContentData = queryResponse.Data.ArticlePage.Items.First().SecondaryContentArea.First().ContentLink.Expanded as IArticlesContentAreaQuery_ArticlePage_Items_SecondaryContentArea_ContentLink_Expanded_ContactPage;
Here am looking only for the first item only to compare results. After casting, when i inspect mainContentData and secondaryContentData I see appropriate values. You can compare against the data I provided and ensure to have the query updated (if anything missing) and also make sure to cast it from correct interface as each item in ContentArea expanded object will have interfaces and need to be used correctly.
let me know if any questions. Unfortunately I cannot attach screenshots.
Still no luck. I have double checked that I've used the correct generated interfaces.
I have the same issue as the original poster, where only the first expanded content is returned. The second has only null values.
It is always like this, and if I swap them around, its still the first that has values.
So for this sample query, ContentArea1_ContentLink_Expanded_NewsPage will have values, but ContentArea2_ContentLink_Expanded_NewsPage will have null-values.
query ContentWithNewsPagesQuery {
ContentPage {
items {
ContentLink {
Id
}
Url
ContentArea1 {
ContentLink {
Expanded {
__typename
... on NewsPage {
__typename
Name
Content
}
}
}
}
ContentArea2 {
ContentLink {
Expanded {
__typename
... on NewsPage {
__typename
Name
Content
}
}
}
}
}
}
And if I just swap the ContentAreas around in the query, it will be the oppsite. ContentArea2_ContentLink_Expanded_NewsPage will have values, but ContentArea1_ContentLink_Expanded_NewsPage will have null-values.
query ContentWithNewsPagesQuery {
ContentPage {
items {
ContentLink {
Id
}
Url
ContentArea2 {
ContentLink {
Expanded {
__typename
... on NewsPage {
__typename
Name
Content
}
}
}
}
ContentArea1 {
ContentLink {
Expanded {
__typename
... on NewsPage {
__typename
Name
Content
}
}
}
}
}
}
}
Hi,
I think the issue here is the generated C# models by StrawberryShakes share one underlying fragment/type mapping.
Have you tried to use alias like this:
Area1: ContentArea1 {
ContentLink {
Expanded {
... on BlockType1 {
Property1
Property2
}
}
}
}
Area2: ContentArea2 {
ContentLink {
Expanded {
... on BlockType2 {
Property1
Property2
}
}
}
}
When querying Optimizely Graph for content in contentareas using Strawberry Shake it seems that we only can get the expanded result from the first area in the query.
If I have this in the query I only get values in the result från ContentArea1. The result from ContentArea2 only contain null values. If I remove the ContentArea1 part from the query I get correct values from ContentArea2. Is there a setting or something else preventing me from getting results from multiple areas in the same query?