Skip to main content

Rebuilding Aggregates Using the REST API

You can use the aggregate-batch endpoint of the AtScale engine REST API to trigger an initial build or rebuild for all aggregates of a deployed model. You can also use it to trigger incremental aggregate builds for specific datasets within a model.

One use case for this feature is the need to rebuild aggregates after ETL (Extract, Transform, Load) jobs. Many companies have ETL jobs that they routinely run to cleanse raw data and load it into the data warehouse. You can use AtScale's REST API to programmatically rebuild aggregates for a model as a part of your ETL processing.

The following sections describe how to use the aggregate-batch endpoint to run different types of aggregate builds.

Trigger an aggregate build via API

You can use aggregate-batch to trigger a non-incremental build or rebuild for a specific model.

Prerequisites

Before triggering an aggregate build via API, ensure that:

  • You have the aggregates_manage role assigned in the Identity Broker. For more information, see Identity Broker Default Roles.
  • The model you want to run builds for has been deployed.

API reference

DetailDescription
Endpointaggregate-batch/projectId/cubeId
URL ParametersprojectId: The ID of the catalog that contains the model you want to run builds for.
Query ParameterscubeId: The ID of the model you want to run builds for.
HTTP MethodPOST
AuthenticationEach API call to the AtScale engine must include an API token in the HTTP request header.
Return Responses201: Created / Success
400: Bad Request
401: Unauthorized
404: Not Found
500: Server Error
503: Server Unavailable

For example:

curl --location 'http://<host>:<port>/aggregate-batch/projectId/<projectId>cubeId=<cubeID>&isFullBuild=false' \
--header 'Content-Type: application/json' \

Trigger an incremental aggregate build via API

You can also use the API to trigger incremental aggregate builds for specific datasets within a model. This enables you to run ad-hoc incremental builds without having to modify the datasets’ configured grace periods.

Prerequisites

Before triggering an incremental aggregate build via API, ensure that:

Important

Enabling this functionality can potentially cause your system to become strained by expensive aggregate rebuilds.

API reference

DetailDescription
Endpointaggregate-batch/projectId/cubeId
URL ParametersprojectId: The ID of the catalog that contains the model you want to run builds for.
Query ParameterscubeId: The ID of the model you want to run builds for.
HTTP MethodPOST
Bodygrace-period-overrides: A list of the datasets you want to provide grace period overrides for, as well as the numeric override values. You can include as many datasets as you want.
AuthenticationEach API call to the AtScale engine must include an API token in the HTTP request header.
Return Responses201: Created / Success
400: Bad Request
401: Unauthorized
404: Not Found
500: Server Error
503: Server Unavailable

For example:

curl --location 'http://<host>:<port>/aggregate-batch/projectId/<projectId>cubeId=<cubeID>&isFullBuild=false' \
--header 'Content-Type: application/json' \
--data '{"grace-period-overrides" :
{
"Internet Sales": 30,
"Reseller Sales": 90
}
}'

Additional information