Create an aggregate

Note

To configure Content Hub, you must either be a superuser or have the necessary permissions granted to you through user group policies.

You can use aggregates to call related entity definitions, data sources, and first-level relations with a single HTTP request instead of multiple requests.

Note

You can only call aggregates through the REST API using the HTTP request GET http://{hostname}/api/aggregates/{aggregate_name}/{id}, where hostname is the the name of your Sitecore Content Hub instance, aggregate_name is the aggregate name, and id is the aggregate identifier.

To create an aggregate:

  1. On the menu bar, click Manage cog icon.

  2. One the Manage page, click Aggregates.

  3. On the Aggregates page, click Aggregate.

  4. In the Aggregate dialog, fill out the following fields.

    Field

    Description

    Name

    Name of the aggregate.

    Configuration

    JSON configuration of the aggregate. Pages you add to the Pages list must use the same entity defined as the aggregate.

    Pages

    Pages to which the aggregate applies. If a page has component conditions with relations, you must add those relations to the aggregate associated with the page.

    Unsecured

    If this is turned on, permissions are not checked for returned items, making the response faster.

  5. To create another aggregate, select the Create another check box.

  6. Click Save. If you selected the Create another check box, the Aggregate dialog displays where you can create another aggregate. If you are not creating another item, the Aggregates page opens.

    Note

    When you create another item, some of the fields are prefilled with values you already defined.

JSON configuration

The JSON configuration of aggregates has the following structure:

RequestResponse
{
 "entitydefinition_name": "M.Asset",
 "definitions": [
  "User",
  "M.Asset",
  "M.AssetType",
  "M.FileDuplicate",
  "M.Localization"
 ],
 "includes": [
  {
   "name": "MasterFile",
   "role": "Parent"
  },
  {
   "name": "AssetTypeToAsset",
   "role": "Child"
  }
 ],
 "datasources": ["ChiliType", "VideoAI.Language"]
}

Property

Description

entitydefinition_name

Root definition of the aggregate. This must be the same definition selected in the Pages field.

definitions

List of definitions to load at the same time as the root definition.

includes

List of relations to the root definition. The related entities to the root definition (whether Child or Parent) are loaded at the same time as the root definition.

datasources

Option lists to load with the root definition.

Entity definitions in both the definitions and includes properties are loaded in the same API call as the root definition. Definitions in definitions but not under includes are loaded in a separate API call.

In the configuration example, the AssetTypeToAsset relation connects M.AssetType to M.Asset, so M.AssetType is loaded in the same call as M.Asset. Because no relation between M.Localization and M.Asset is included in this configuration, M.Localization is loaded in a separate call.

Do you have some feedback for us?

If you have suggestions for improving this article,