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

Configure the package settings in ASP.NET Core

Steps necessary to set the configuration.

👍

Beta

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

Open appsettings.json and ensure it has the following settings:

"Optimizely": {
  "ContentGraph": {
    "GatewayAddress": "",
    "AppKey": "",
    "Secret": "",
    "SingleKey": "",
    "QueryPath": ""
  }
}
  • GatewayAddress – URL for the API Gateway. This value should be set to https://cg.optimizely.com for all production environments.
  • AppKey – Sent to you when the account was created, is the public key from your HMAC authentication pair.
  • Secret – Sent to you when the account was created, is the secret key from your HMAC authentication pair.
  • SingleKey – Sent to you when your account was created, is the public key which you can use on the public site.
  • QueryPath – The value for GraphQL query path, default value is "content/v2".

Add the following configuration to Startup.cs and customize the configuration options as needed.

services.AddContentGraphClient(options=>
   {
      //options.UseHmacKey = false;
      //options.QueryPath = "content/v2?cache=false";
      //options.Cache = true;
   });
  • UseHmacKey
    • When the option is set to true, you determine your requests is used HMAC key for the requests.
    • When the option is set to false, single key will be used and your search response will be filtered some values by our default conventions.
      • For example: [Status] field should be "Published", [RolesWithReadAccess] should allow for only viewer.
    • The default value is true.
  • Cache– Specify whether your query will be cached in the Optimizely Graph server. Default value is true.