Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev guideRecipesAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Joins with link

How to create joins on items within and across content types.

👍

Beta

The Optimizely Graph .NET Client is in beta. Contact your Customer Success Manager for information.

Items are instances of content types. You can join items from the same or other content types within or across sources in a single Optimizely Graph query by linking them with different connection types. This makes it possible to query your content as a graph, although still represented as a hierarchy due to the nature of GraphQL.

Before you create a link query, you should configure your content types in the schema. See configuration of links.

Use the Link method to create the link query:

var linkQuery = 
new LinkQueryBuilder<BiographyPage>()
.WithLinkType("MyCustomLinkType")
.Fields(x=>x.Name);

var query = queryBuilder
.OperationName("MyQuery")
.ForType<StartPage>()
.Fields(x=>x.Name)
.Total()
.Link(linkQuery);

var rawData = await query.GetRawResultAsync();
var content = //convert rawData to your content

The Link query's response is very dynamic. You should convert the JSON response to the data objects by yourself. Use GetRawResultAsync to get raw data as a string.