# 지표 API
호출 방법에 대해서는 오픈 API의 호출 방법 설명을 참조하십시오.
사용 시나리오를 이해하려면 사용자 가이드에서 지표를 참조할 수 있습니다.
# 1. 지표 목록
인터페이스 URL
/open/metric-list?token=xxx
요청 방법
POST
콘텐츠 유형
application/json
요청 쿼리 파라미터
Parameter name  |  Sample value  |  Parameter type  |  Is required  |  Parameter description  | 
|---|---|---|---|---|
token  |  xxx  |  String  |  Yes  |  token  | 
Request Body Parameter
{
  "projectId": 102,
  "metricName": "retention_1", 
  "metricDesc": "retention_day1",
  "metricModes": ["EVENT","RETENTION"],
  "createUser":"root",
  "updateUser":"root",
  "timeParticleSize":"day"
}
$$Parameter name  |  Sample value  |  Parameter type  |  Is required  |  Parameter description  | 
|---|---|---|---|---|
projectId  |  102  |  Integer  |  Yes  |  Project ID  | 
metricName  |  retention_1  |  String  |  No  |  Metric Name  | 
metricDesc  |  retention_day1  |  String  |  No  |  Display name  | 
metricModes  |  ["EVENT", "RETENTION"]  |  List  |  No  |  Created from 
  | 
createUser  |  root  |  String  |  No  |  Login user name  | 
updateUser  |  root  |  String  |  No  |  Login user name  | 
timeParticle  |  day  |  String  |  No  |  Unit of the time period taken for analysis 
  | 
성공적인 요청 예시
{
    "data":
    [
        {
            "metricId": 1,
            "projectId": 2,
            "metricName": "retention_1",
            "metricDesc": "retention_day1",
            "metricRemark": "test_retention",
            "metricMode": "EVENT",
            "createUser": "root",
            "updateUser": "root",
            "createTime": "2022-12-12 10:10:00",
            "updateTime": "2022-12-12 10:10:00",
            "timeParticles":["minute"],
            "format": "FORMAT_FLOAT"
        }
    ],
    "return_code": 0,
    "return_message": "success"
}
# 2. 지표 쿼리
인터페이스 URL
/open/metric-data?token=xxx
요청 방법
POST
콘텐츠 유형
application/json
요청 쿼리 파라미터
Parameter name  |  Sample value  |  Parameter type  |  Is required  |  Parameter description  | 
|---|---|---|---|---|
token  |  xxx  |  String  |  Yes  |  token  | 
Request Body Parameter
{
    "eventView": {
        "comparedByTime": true,
        "comparedStartTime": "2021-12-14 00:00:00",
        "comparedEndTime": "2021-12-20 23:59:59",
        "comparedRecentDay": "8-14",
        "startTime": "2021-12-21 00:00:00",
        "endTime": "2021-12-27 23:59:59",
        "recentDay": "1-7",
        "timeParticleSize": "day",
        "groupBy": [{
            "columnDesc": "brand",
            "columnName": "brand",
            "propertyRange": "",
            "specifiedClusterDate": "2021-12-28",
            "tableType": "event"
        }],
        "relation": "and",
        "filts": [{
            "columnDesc": "brand",
            "columnName": "brand",
            "comparator": "equal",
            "filterType": "SIMPLE",
            "ftv": ["Apple", "Xiaomi"],
            "specifiedClusterDate": "2021-12-28",
            "tableType": "event",
            "timeUnit": ""
        }],
        "queryFeature": {
            "approximateOn": true,
            "globalQueryOn": false
        }
    },
    "metrics":["retention_1","dau"]
    "zoneOffset": 0
    "projectId": 377,
    "useSameResultKey": false,
    "useCache": true,
    "limit": 1000,
    "timeoutSeconds": 10
}
$$Parameter name  |  Sample value  |  Parameter type  |  Is required  |  Parameter description  | 
|---|---|---|---|---|
eventView  |  -  |  Object  |  Yes  |  Metrics common attribute part.  | 
eventView.comparedByTime  |  true  |  Boolean  |  No  |  Whether to compare the time, TRUE: Yes, FALSE: No  | 
eventView.comparedStartTime  |  2021-12-14 00:00:00  |  String  |  No  |  Contrast time start time (format: yyyy-MM-dd HH: mm: ss), the comparison time is valid when the relative time is empty  | 
eventView.comparedEndTime  |  2021-12-20 23:59:59  |  String  |  No  |  Compare time end time (format: yyyy-MM-dd HH: mm: ss), valid when the comparison time is empty relative to time  | 
eventView.comparedRecentDay  |  8-14  |  String  |  No  |  Comparison time relative time (when comparedByTime is TRUE, this item cannot be empty both with the start time and end time of the comparison time)  | 
eventView.startTime  |  2021-12-21 00:00:00  |  String  |  No  |  Start time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty  | 
eventView.endTime  |  2021-12-27 23:59:59  |  String  |  No  |  End time (format: yyyy-MM-dd HH: mm: ss), valid when the relative time is empty  | 
eventView.recentDay  |  1-7  |  String  |  No  |  Relative time (this item cannot be empty both with the start time and the end time)  | 
eventView.relation  |  and  |  String  |  No  |  Logical relationship, and: logical and, or: logical or  | 
eventView.timeParticleSize  |  day  |  String  |  Yes  |  Unit of the time period taken for analysis 
  | 
eventView.groupBy  |  -  |  List  |  No  |  Grouping property part, zero or more  | 
eventView.groupBy.columnName  |  brand  |  String  |  Yes  |  Field name  | 
eventView.groupBy.columnDesc  |  Brand  |  String  |  No  |  Field display name  | 
eventView.groupBy.propertyRange  |  String  |  No  |  Self-defined property interval  | |
eventView.groupBy.propertyRangeType  |  String  |  No  |  Property interval type, which can be used as self-defined bucketing conditions when grouping numeric properties 
  | |
eventView.groupBy.specifiedClusterDate  |  2021-12-28  |  String  |  No  |  Historical tag version of specified date  | 
eventView.groupBy.tableType  |  event  |  String  |  Yes  |  |
eventView.filts  |  -  |  List  |  No  |  Global filters parts  | 
eventView.filts.columnDesc  |  Brand  |  String  |  No  |  Field display name  | 
eventView.filts.columnName  |  brand  |  String  |  Yes  |  Field name  | 
eventView.filts.comparator  |  equal  |  String  |  Yes  |  Reference: filtering expression of model query API  | 
eventView.filts.filterType  |  SIMPLE  |  String  |  No  |  Filtering mode, SIMPLE: simple, COMPOUND: compound, default as SIMPLE  | 
eventView.filts.ftv  |  ["Apple", "Xiaomi"]  |  List  |  No  |  Property comparative with bound literial  | 
eventView.filts.specifiedClusterDate  |  2021-12-28  |  String  |  No  |  Historical tag version of specified date  | 
eventView.filts.tableType  |  event  |  String  |  Yes  |  |
eventView.filts.timeUnit  |  String  |  No  |  Property filter unit, only valid to relativeEvent*:day,hour,minute  | |
eventView.queryFeature  |  -  |  Object  |  No  |  Query configuration  | 
eventView.queryFeature.approximateOn  |  true  |  Boolean  |  No  |  Enable approximate calculation or not  | 
metrics  |  ["retention_1","dau"]  |  list  |  Yes  |  List of Product Metrics  | 
projectId  |  377  |  Integer  |  Yes  |  Project numeric identity  | 
zoneOffset  |  0  |  Integer  |  No  |  Time zone  | 
useCache  |  true  |  Boolean  |  No  |  Use cache, optional parameter, default value: true  | 
limit  |  1000  |  Integer  |  No  |  Upper limit of the group number of each analysis object, optional parameter, default value: 1000, maximum value: 10000  | 
timeoutSeconds  |  10  |  Integer  |  No  |  Request timeout parameter. Query task should be cancelled after the request times out.  | 
성공적인 요청 예시
{
    "data": {
        "result_generate_time": "2021-12-30 11:15:41", 
        "union_groups": [
            [
                "Safari", 
                "apple"
            ], 
            [
                "Firefox", 
                "xiaomi"
            ], 
            [
                "WeChat built-in browser", 
                "apple"
            ], 
            [
                "total", 
                "apple"
            ], 
            [
                "total", 
                "xiaomi"
            ]
        ], 
        "x": [
            "2021-12-23", 
            "2021-12-24", 
            "2021-12-25", 
            "2021-12-26", 
            "2021-12-27", 
            "2021-12-28", 
            "2021-12-29"
        ], 
        "x_compared": [
            "2021-12-16", 
            "2021-12-17", 
            "2021-12-18", 
            "2021-12-19", 
            "2021-12-20", 
            "2021-12-21", 
            "2021-12-22"
        ], 
        "y": [
            {
                "retention_1": [
                    {
                        "group_cols": [
                            "Safari", 
                            "apple"
                        ], 
                        "group_num": 3, 
                        "values": [
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0"
                        ], 
                        "values_compared": [
                            "447", 
                            "980", 
                            "1584", 
                            "321", 
                            "285", 
                            "74", 
                            "0"
                        ]
                    }, 
                    {
                        "group_cols": [
                            "Firefox", 
                            "xiaomi"
                        ], 
                        "group_num": 3, 
                        "values": [
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0"
                        ], 
                        "values_compared": [
                            "291", 
                            "818", 
                            "1128", 
                            "272", 
                            "219", 
                            "58", 
                            "0"
                        ]
                    }, 
                    {
                        "group_cols": [
                            "chrome", 
                            "apple"
                        ], 
                        "group_num": 3, 
                        "values": [
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0"
                        ], 
                        "values_compared": [
                            "231", 
                            "500", 
                            "764", 
                            "214", 
                            "155", 
                            "35", 
                            "0"
                        ]
                    }
                ]
            }, 
            {
                "dau": [
                    {
                        "group_cols": [
                            "total", 
                            "apple"
                        ], 
                        "group_num": 2, 
                        "values": [
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0"
                        ], 
                        "values_compared": [
                            "640", 
                            "811", 
                            "1251", 
                            "1253", 
                            "720", 
                            "113", 
                            "0"
                        ]
                    }, 
                    {
                        "group_cols": [
                            "total", 
                            "xiaomi"
                        ], 
                        "group_num": 2, 
                        "values": [
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0", 
                            "0"
                        ], 
                        "values_compared": [
                            "277", 
                            "439", 
                            "600", 
                            "666", 
                            "364", 
                            "59", 
                            "0"
                        ]
                    }
                ]
            }
        ]
    }, 
    "return_code": 0, 
    "return_message": "success"
}
응답 파라미터 설명
$$Parameter name  |  Sample value  |  Parameter type  |  Parameter description  | 
|---|---|---|---|
data  |  -  |  Object  |  Return results  | 
data.result_generate_time  |  2021/12/29 12:00  |  String  |  Query result generation time  | 
data.union_groups  |  ["Apple"]  |  List  |  All Grouping Set  | 
data.x  |  ["2021-12-23"]  |  List  |  X-axile time  | 
data.x_compared  |  ["2021-12-16"]  |  List  |  X-axile comparison time  | 
data.y  |  -  |  List  |  Y-axile data list  | 
data.y.{metric name}  |  -  |  List  |  Y-axile metric information list  | 
data.y.{metric name}.group_cols  |  ["Apple"]  |  List  |  Y-axile metric group  | 
data.y.{metric name}.group_num  |  3  |  Integer  |  Y-axile metric group number  | 
data.y.{metric name}.values  |  ["0"]  |  List  |  Y-axile metric value  | 
data.y.{metric name}.values_compared  |  ["447"]  |  List  |  Y-axile time comparison metric value  | 
return_code  |  0  |  Integer  |  Return code  | 
return_message  |  success  |  String  |  Return message  | 
