Skip to content

Review required 8269ed41

API Description

This API queries multidimensional attribution results for metrics and dimensions. It returns changes across comparison dates and each dimension’s contribution rate.

API URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/metric/attribution/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.
dimensions List Yes List of analysis dimension names. Any characters are supported, up to 150 characters.
filters List No Filters. These reference dimension entities.
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.

`"orders": [
       {
            "column":            "overallContributionRate",
             "type": "DESC"
}
]
limit Intger 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:
"currentFilter":
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 Data result. For parameter details, see 4.2 data parameter description.

data ParameterDescription

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

table ParameterDescription

Parameter Type Required Max Length Description
all array Yes For parameter details, see 4.4 all parameter description.
dimensions array 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 value
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

Request Example

{
    "metric": "testtesttest",
    "dimensions": [
        "BWBDM"
    ],
    "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": [

    ]
}

Response Example

{
    "data": {
        "metric": "testtesttest",
        "table": {
            "all": {
                "dimensionValue": null,
                "currentValue": 90.0,
                "comparisonValue": 0.0,
                "growth": 90.0,
                "growthRate": 9.0E7,
                "overallContributionRate": null,
                "relativeContributionRate": null
            },
            "dimensions": {
                "BWBDM": {
                    "dimensionValue": [
                        "RMB"
                    ],
                    "currentValue": [
                        90.0
                    ],
                    "comparisonValue": [
                        0.0
                    ],
                    "growth": [
                        90.0
                    ],
                    "growthRate": [
                        9.0E7
                    ],
                    "overallContributionRate": [
                        1.0
                    ],
                    "relativeContributionRate": null
                }
            }
        }
    },
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "d6b9429207254f6883edddc1ad5ec14e.28656.17353825580631533"
}