Skip to content

Product Category Search with our .NET client ‚Äč

Relewise has a .NET SDK which, among other things, will make implementing search very easy.
It is available via NuGet.

csharp
ISearcher seacher = new Searcher(
  new Guid("00000000-0000-0000-0000-000000000001"), 
  "your api key");

Before going any further, make sure you have read the following:

  • Read about how to authenticate against our API here.
  • Read about handling different types of users here.

Also remember to specify your Server URL in your request.

The following shows an example on how to perform a product category search with an assortment filter:

csharp
var request = new ProductCategorySearchRequest(
    new Language("da"),
    new Currency("DKK"),
    GetUser(),
    "Search Page",
    "shoe",
    skip: 0,
    take: 30);

request.Settings.SelectedCategoryProperties = new SelectedProductCategoryPropertiesSettings
{
    DisplayName = true,
    Paths = true,
    DataKeys = new string[] { "Description", "ImagePath" },
};

request.Filters.Add(new ProductCategoryAssortmentFilter(1));

ProductCategorySearchResponse response = await searcher.SearchAsync(request, cancellationToken);

By using SelectedCategoryProperties it is possible to select the specific properties, from Relewise, that you need for rendering a category tile, list etc. That way we can store fields that are needed for e.g. filtering or Merchandising, but which might not be needed when rendering the actual product. This allows us to reduce the payload on the HTTP responses, by only returning a minimum set of necessary information.

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com