Get started
How to get started with the Optimizely Graph .NET Source SDK.
The Optimizely Graph .NET Source SDK streamlines the configuration and setup process of Optimizely Graph for developers. The SDK serves as a C# wrapper around the Optimizely Graph API, abstracting the intricacies of API communication and data handling. It lets you configure content types, build datasets, and sync content with Optimizely Graph easily using C#.
The SDK seamlessly integrates into any .NET backend application. You can push data from external sources, which offers a flexible content management solution for all business requirements.
See the Introducing Optimizely Graph Source .NET SDK blog for more information.
Access
The SDK is open source and available on GitHub.
Configure
To begin, initialize a new instance of the GraphSourceClient
by invoking the static Create
method. Pass in your base URL, Optimizely Graph source, application key, and secret, as shown in the following code sample:
var client = GraphSourceClient.Create(
new Uri("<https://cg.optimizely.com">),
"SOURCE",
"APPLICATION_KEY",
"SECRET"
);
How to find your credentials depends on what type of project you have:
- Dev environment or self-hosted CMS – Optimizely emails your credentials using a one time secret.
- DXP – You can see your credentials in the DXP portal (PaaS portal).
- CMS (SaaS) –You can see your credentials in the Dashboard.
Once your client is initialized, you can configure content types using any C# class object. This integration lets you manage content within your existing application’s codebase.
Example
For example, a cafe needs to configure content for its menu. With the .NET Source SDK, you can model the menu structure using C# classes. The following is a sample class definition for a cafe:
public class Cafe
{
public string Name { get; set; }
public DateTime Established { get; set; }
public Location Address { get; set; }
public Menu Menu { get; set; }
}
public class Location
{
public string City { get; set; }
public string State { get; set; }
public string Zipcode { get; set; }
public string Country { get; set; }
}
public class Menu
{
public Beverage Beverage { get; set; }
public Food Food { get; set; }
}
public class Beverage
{
public string Name { get; set; }
public double Price { get; set; }
public List<string> Sizes { get; set; }
}
public class Food
{
public string Name { get; set; }
public double Price { get; set; }
public bool IsAvailable { get; set; }
}
By handling the configuration, the .NET Source SDK lets you focus on building high-performance applications while managing data effectively.
Next steps
After initializing and configuring your .NET Source SDK, you can define and manage content types. See Content types for how to configure content types and use different index types for data retrieval and management.
Updated 15 days ago