How to Obtain Aggregations Data
You can obtain a calculated Aggregations table in the CSV format using Timeline API.
For example, you may want to take some custom metrics, aggregated and calculated in Timeline, and export them to a separate application or system to proceed working with resulting values or process these values as a separate data set. To do it, follow the instructions below.
Note. For information on where to find path parameter values for the endpoints, see Project path parameters.
Before you begin
There are some preconditions, both mandatory and optional, to keep in mind:
- Aggregations should be configured and calculated in advance using Timeline interface. These actions are not supported through API at the moment.
For instructions, see Aggregations. - Before exporting the table itself, you can obtain aggregation headers from a desired project. This will allow preparing a table with a matching structure in the target system. To do it, send a GET request to:
{your.timeline.instance}.com/api/ext/1.0/project/{projectId}/metric-table-columns
Path parameters: projectId
In response, you will receive the list of the table headers, where: - columnName - is the actual name of a column in the Aggregations table.
- type - indicates columns content:
- METRIC
The column contains one of the calculated metrics included in the aggregation. - DIMENSION
The column contains one of the dimensions selected in the aggregation. - DATE
The column contains timestamps for values from other columns.
For general information about Metrics, see Metrics.
For general information about Dimensions, see Dimensions.Show CURL example
- When obtaining aggregation data, you can specify the time frame for the returned values in the request directly. However, if you want to erase calculated data for a certain time period once and for all, you can delete the excessive metric data based on their timestamps. To do it, send a DELETE request to:
{your.timeline.instance}.com/api/ext/1.0/project/{projectId}/metrics
Path parameters: projectId
Request query parameters (optional): from, to.
Values of these parameters should be Unix timestamps in seconds (e.g. 1686554976) or have ISO format (e.g. 2023-06-12T09:29:36+00:00).
Important. Sending this request without optional parameters will delete all the values from the table, except the heading row. The aggregation entry itself will persist.
In response, you will receive true in case of success. The rows related to the time period between the timestamps specified in the optional parameters will be deleted.Show CURL example
Obtaining Aggregations Data
- Send a GET request to start collecting the calculated aggregation table. Endpoint:
{your.timeline.instance}.com/api/ext/1.0/project/{projectId}/metrics
Required parameters: projectId
Request parameters (optional): from, to
Values of these parameters should be Unix timestamps in seconds (e.g. 1686554976) or in ISO format (e.g. 2023-06-12T09:29:36+00:00).
In response, along with the FINISHED status, you will receive a processingId. - Send a GET request with the processingId returned by the previous request. Endpoint:
{your.timeline.instance}.com/api/ext/1.0/processing/{processingId}
Poll the processing endpoint until the status becomes FINISHED.
In response, you will receive a URL. - Send a GET request to the received URL. This will start a download of a CSV file with the Aggregations table. The file will be downloaded to the machine or server from which the request was made.
The content of the file will depend on the aggregation's configuration - metrics and dimensions added to it. The exported table is an exact copy of the one you see in Timeline interface.
Examples
For Windows
For Linux
05.09.2024 16:23:54