logo
logo

Aggregates

Use aggregates to call related entity definitions, data sources, and first-level relations with a single HTTP request instead of multiple calls.

Warning

Aggregates do not support conditional members and conditional member groups.

Note

For information about aggregate configurations, see Aggregate configuration.

Example

The following example shows the details of the ALtest aggregate. The ID number of the aggregate is highlighted.

All the entities included in the aggregate are related to the M.PCM.ProductFamily entity definition. For information about the product family that the asset belongs to, look at the definition in the aggregate. For example, in the Powerful Granola product family, the Powerful Granola presentation asset is a linked asset:

Request

The base URL of the Content Hub solution is https://demositecorecontenthub.com:

  • To call the aggregate, you use the HTTP request GET http://demositecorecontenthub.com/api/aggregates/{Aggregate_name}/{id}.
  • In this example, the request is: GET https://demositecorecontenthub.com/api/aggregates/ALtest/31041

The call aggregates all the definitions and all the related entity definitions included in the aggregate as well as the data sources and the first-level relations defined in the aggregate. To return all this data separately would require many calls. However, an aggregate groups all the calls into a single call to the aggregate endpoint.

Response

The M.PCM.ProductFamily entity definition provides all the details of the Powerful Granola product family in the ALtest aggregate because there is a relation based on M.Asset is Child of M.PCM.ProductFamily in the M.Asset entity definition:

{
  "entitydefinition_name": "M.Asset",
  "definitions": ["M.PCM.Product", "M.PCM.ProductFamily", "M.PCM.Catalog"],
  "includes": [
    {
      "name": "PCMProductFamilyToAsset",
      "role": "Child"
    },
    {
      "name": "PCMCatalogToAsset",
      "role": "Child"
    }
  ],
  "datasources": ["VirusScanResult"]
}

The response includes the related definition of M.PCM.ProductFamily and contains details of the product families that the asset belongs to. The response also includes the details of the Powerful Granola product family:

Since there is a relation based on M.Asset is Child of M.PCM.ProductFamily in the M.Asset entity, we use the PCM.ProductFamilies definition to return all the details of the Powerful Granola product family in the ALtest aggregate:

{
  "entity": {
    "id": 30289,
    "identifier": "Demo.ProductFamily.Granola",
    "cultures": ["en-US"],
    "properties": {
      "ProductFamilyName": "Powerful Granola",
      "ProductFamilyLabel": {
        "en-US": "Powerful Granola"
      },
      "ProductFamilyShortDescription": {
        "en-US": "Granola for strength\n"
      },
      "ProductFamilyLongDescription": {
        "en-US": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur finibus feugiat suscipit. Pellentesque urna odio, viverra sed ex convallis, mollis hendrerit tortor. Proin a purus ante. Pellentesque velit orci, pellentesque et mollis vel, blandit et ipsum. Vestibulum tellus turpis, rutrum ut diam viverra, interdum fermentum est. Aliquam egestas porta augue ut volutpat. Sed eu sollicitudin lacus.</p>\n<p>Phasellus augue felis, euismod non metus non, tincidunt congue metus. Aliquam nec ligula vehicula elit ullamcorper viverra. Curabitur viverra convallis eros ut fermentum. Cras at metus ultricies, tempus lorem eu, porttitor mi. Duis gravida dolor nisi, at facilisis mi dignissim at. Curabitur augue massa, malesuada non fermentum sit amet, tincidunt convallis tellus. Mauris blandit ante sit amet semper rhoncus. Curabitur cursus nibh interdum luctus imperdiet. Proin rutrum ornare mollis. Aliquam gravida neque turpis, vel pulvinar quam tincidunt nec. Aliquam ut odio enim.</p>"
      }
    }
  }
}

Can we improve this article ? Provide feedback