1. Clients

Taxonomy client

A taxonomy contains values that you can associate with content in order to categorize items into groups. The following methods are available for taxonomies.

MethodDescription
GET /api/content/v1/taxonomiesRetrieves all taxonomies, including the name and ID as well as the properties of associated taxonomy values.
POST /api/content/v1/taxonomiesCreates a taxonomy.
GET /api/content/v1/taxonomies/<TAXONOMY_ID>Retrieves a specific taxonomy.
PUT /api/content/v1/taxonomies/<TAXONOMY_ID>Updates a specific taxonomy.
DELETE /api/content/v1/taxonomies/<TAXONOMY_ID>Deletes a specific taxonomy.

The following example illustrates these methods:

public interface ITaxonomyClient
{
  // POST /api/content/v1/taxonomies
  Task<Taxonomy> CreateAsync(
    Taxonomy taxonomy,
    CancellationToken cancellationToken = default);

  // PUT /api/content/v1/taxonomies/<TAXONOMY_ID>
  Task<Taxonomy> UpdateAsync(
    Taxonomy taxonomy,
    CancellationToken cancellationToken = default);

  // DELETE /api/content/v1/taxonomies/<TAXONOMY_ID>
  Task DeleteAsync(
    string taxonomyId,
    CancellationToken cancellationToken = default);

  // GET /api/content/v1/taxonomies
  Task<PagedResponse<Taxonomy>> GetAsync(
    TaxonomySearchRequest? searchRequest = null,
    CancellationToken cancellationToken = default);

  // Same as GetAsync, but processing the results as an enumerator.
  IAsyncEnumerable<Taxonomy> EnumerateAsync(
    TaxonomySearchRequest? searchRequest = null,
    CancellationToken cancellationToken = default);

  // GET /api/content/v1/taxonomies/<TAXONOMY_ID>
  Task<Taxonomy?> SingleAsync(
    string taxonomyId,
    CancellationToken cancellationToken = default);

  // GET /api/content/v1/taxonomies/<TAXONOMY_ID>
  // Same as SingleAsync above, but with client-side caching.
  Task<Taxonomy?> SingleCachedAsync(
    string taxonomyId,
    CancellationToken cancellationToken = default);
}
If you have suggestions for improving this article, let us know!