Skip to content

Review required d841415b

API Description

This API helps users analyze the causes of changes in a specific business metric in detail.

API URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/metric/attribution/drill/report/query

For how to obtain anymetrics_host:anymetrics_port, see Calling APIs

Request Parameters

Common Request Parameters (HEADERS)

Parameter Type Required Description
tenant-id String Yes Tenant ID, used to identify the tenant that contains the metric query content
auth-type String Yes Authentication method. Supports UIDTOKENACCOUNTAPIKEY
auth-value String Yes Authentication value corresponding to auth-type

How to Obtain Common Parameters

You can obtain tenant-id in Aloudata CAN by choosing Metric Applications in the top navigation and API Integration in the left menu. Fill in auth-value according to the selected auth-type.

Request Parameters

Parameter Type Required Description
attributionRange Map Yes For details, see attributionRange parameter description.
metric String Yes Metric name used for attribution analysis.
dimension String Yes List of analysis dimension names. Any characters are supported, up to 150 characters.
filters List No Filters

1. Value of the current drill-down dimension;

2. Filters used by the original metric analysis;
orders List No Sort rules for the query. By default, results are sorted by contributionRate in descending order. Sortable columns: currentValue, comparisonValue, growth, growthRate, and contributionRate.

<br> "orders": [<br> {<br> "column": "overallContributionRate",<br> "type": "DESC"<br> }<br> ]<br>
limit Integer No Number of returned rows. The default is 200.

attributionRange ParameterDescription

Parameter Type Required Description
granularity String Yes Time granularity: DAY, WEEK, MONTH, QUARTER, YEAR
currentFilter String Yes Current time
comparisonType String Yes Comparison type: CUSTOM, DOD, YOY, MOM, QOQ, WOW
endDateTime String No When comparison type is CUSTOM, specify startDateTime and endDateTime.
startDateTime String No

ResponseParameter

ResponseParameterDescription

Parameter Type Required Max Length Description
code String Yes 32 API response code
message String Yes 512 Message body
traceId String Yes 128 traceId
data Object Yes For parameter details, see 4.2 data parameter description.

data ParameterDescription

Parameter Type Required Max Length Description
metric String Yes Metric code
table Object For parameter details, see 4.3 table parameter description.

table ParameterDescription

Parameter Type Required Max Length Description
all Object Yes For parameter details, see 4.4 all parameter description.
dimension Object Yes For parameter details, see 4.5 dimensions parameter description.

all ParameterDescription

Parameter Type Required Max Length Description
currentValue Double Yes Current value
comparisonValue Double Yes Baseline value used for comparison. It usually comes from a previous time period or different conditions, such as sales from last month.
growth Double Yes Growth value: the difference between current value and comparison value. It usually represents the actual increase or decrease, such as current sales minus last month’s sales.
growthRate Double Yes Growth rate: the percentage of growth relative to the comparison value. It indicates relative growth and is typically calculated as (growth value / comparison value) x 100%.
contributionRate Double Yes Contribution of the current dimension to overall growth

dimensions ParameterDescription

Parameter Type Required Max Length Description
dimensionValue List Yes Dimension name
currentValue List Yes Current value
comparisonValue List Yes Comparison value
growth List Yes Growth value
growthRate List Yes Growth rate
contributionRate List Yes Contribution rate

Example

Example 1:

  • Request
{
    "metric": "total_Count",
    "dimension": 
        "brond_name"
    ,
    "attributionRange": {
        "granularity": "DAY",
        "comparisonType": "CUSTOM",
        "startDateTime": "2024-12-23 12:18:22",
        "endDateTime": "2024-12-23 12:18:22",
        "currentFilter": {
            "type": "EXPR",
            "expr": "DateTrunc([metric_time], \"DAY\")=\"2024-11-25\""
        }
    },
    "filters": [
        "IN(['province'],\"Zhejiang\")"
    ],
     "orders": [
        {
            "column": "overallContributionRate",
            "type": "DESC"
        }
    ]

    "limit":100
}

Request description: This query obtains data for the total_Count metric and groups it by the brond_name dimension at daily granularity. The filter is limited to data from 2024-11-25, compared with 2024-12-23, and further drills down to filter total_Count for Zhejiang. Final results are sorted by brand name in descending order and limited to the first 100 rows.

  • Response
{
    "data": {
        "metric": null,
        "table": {
            "all": {
                "dimensionValue": null,
                "currentValue": 91.0,
                "comparisonValue": 0.0,
                "growth": 91.0,
                "growthRate": 9.1E7,
                "overallContributionRate": null,
                "relativeContributionRate": null
            },
            "dimensions": {
                "product_name": {
                    "dimensionValue": [
                        "aa"
                    ],
                    "currentValue": [
                        91.0
                    ],
                    "comparisonValue": [
                        0.0
                    ],
                    "growth": [
                        91.0
                    ],
                    "growthRate": [
                        9.1E7
                    ],
                    "overallContributionRate": [
                        1.0
                    ],
                    "relativeContributionRate": null
                }
            }
        }
    },
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "d6b9429207254f6883edddc1ad5ec14e.189.17355483517995045"
}