Create an aggregate
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.
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:
-
On the menu bar, click Manage
.
-
One the Manage page, click Aggregates.
-
On the Aggregates page, click
Aggregate.
-
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.
-
To create another aggregate, select the Create another check box.
-
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.
NoteWhen 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:
{
"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.