Skip to main content
Required ACL: editSettings

Usage

// Initialize the client
var client = new CompositionClient(
  new CompositionConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
);

// Call the API
var response = await client.PutCompositionAsync(
  "my-compo",
  new Composition
  {
    ObjectID = "my-compo",
    Name = "my composition",
    Behavior = new CompositionBehavior
    {
      Injection = new Injection
      {
        Main = new Main
        {
          Source = new CompositionSource
          {
            Search = new CompositionSourceSearch
            {
              Index = "foo",
              Params = new MainInjectionQueryParameters { Filters = "brand:adidas" },
            },
          },
        },
        InjectedItems = new List<InjectedItem>
        {
          new InjectedItem
          {
            Key = "my-unique-injected-item-key",
            Source = new InjectedItemSource(
              new SearchSource
              {
                Search = new Algolia.Search.Models.Composition.Search { Index = "foo" },
              }
            ),
            Position = 2,
            Length = 1,
          },
        },
        Deduplication = new Deduplication
        {
          Positioning = Enum.Parse<DedupPositioning>("Highest"),
        },
      },
    },
  }
);
// >LOG

See the full API reference

For more details about input parameters and response fields.
I