1. Clients

Content types client

The content model in Content Hub ONE is defined by one or more content types. The following methods are available for content types.

MethodDescription
GET /api/content/v1/typesRetrieves prefix, label, and visualization properties of all content type entities.
POST /api/content/v1/typesCreates a content type entity.
GET /api/content/v1/types/<CONTENT_TYPE_ID>Retrieves prefix, label, and visualization properties of a specific content type entity.
PUT /api/content/v1/types/<CONTENT_TYPE_ID>Updates a content type entity.
DELETE /api/content/v1/types/<CONTENT_TYPE_ID>Deletes a content type entity, as well as all linked member groups and their members.

The following example illustrates these methods:

public interface IContentTypeClient
{
  // POST /api/content/v1/types
  Task<ContentType> CreateAsync(
    ContentType contentType,
    CancellationToken cancellationToken = default);

  // PUT /api/content/v1/types/<CONTENT_TYPE_ID>
  Task<ContentType> UpdateAsync(
    ContentType request,
    CancellationToken cancellationToken = default);

  // DELETE /api/content/v1/types/<CONTENT_TYPE_ID>
  Task DeleteAsync(
    string contentTypeId,
    CancellationToken cancellationToken = default);

  // GET /api/content/v1/types
  Task<PagedResponse<ContentType>> GetAsync(
    ContentTypeSearchRequest? searchRequest = null,
    CancellationToken cancellationToken = default);

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

  // GET /api/content/v1/types/<contentTypeId>
  Task<ContentType?> SingleAsync(
    string contentTypeId,
    CancellationToken cancellationToken = default);

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