You need to enable JavaScript to run this app.
导航
查询分析(SaaS)
最近更新时间:2024.06.30 18:36:02首次发布时间:2024.06.30 18:36:02

请求说明

  • Context-Path: /datafinder
  • Path:/openapi/v1/analysis
  • Method: POST
  • Content-type: application/json

请求参数

  • Body:
    • 请求参数均采用查询 DSL 进行描述,详情请参见4. DSL 结构说明
    • 数据编码为 UTF-8

返回参数

  • Response:
    结构说明:
    {
        "code": 200, # 返回码,200代表查询返回正确,非200请参考返回消息中的message
        "data": [
            {
                "error_message": null, # 错误消息
                "region_info_map": {}, # 区域查询时区域id映射
                "trace_id": "6bcbc580ab144afd8b8a792349ed9a5a", # 链路追踪标识
                "query_id": "a00:p00:c00:q00", # 子查询标识
                "result_status": "SUCCESS", # 子查询状态
                "execute_time": 0, # 子查询执行时间
                "data_item_list": [ # 子查询返回数据
                    {
                        "filter_label": null, # 过滤标签
                        "group_by_key": "__all", # 分组key
                        "data": [ # 指标数据
                            142099,
                            145940,
                            139035,
                            148457,
                            154313
                        ],
                        "sum_value_square": 106673323444, # 指标平方和
                        "composed_item_key": null,
                        "item_key": "a00:p00:c00:q00:f00_0",
                        "show_name": "活跃用户数",
                        "sum": 729844, # 指标求和值
                        "event_params": {},
                        "filter_value": null,
                        "event_name_alias": "",
                        "prefix_key": "active_user",
                        "avg": 145968.8, # 指标平均值
                        "result_type_unit": null,
                        "event_show_name": "应用启动",
                        "event_indicator_params": {},
                        "composed_label": null,
                        "show_label": "active_user",
                        "suffix_key": "__all",
                        "origin_profile_params": {},
                        "result_type": "event_users",
                        "attr_value_name": "",
                        "result_type_label": "活跃用户数",
                        "is_disabled": null,
                        "profile_params": {},
                        "event_label": "active_user",
                        "origin_key": "__all",
                        "event_id": null,
                        "is_compute": null,
                        "name": "active_user, __all",
                        "event_name": "app_launch",
                        "group_by_type": "user_attr"
                    }
                ],
                "error_code": null,
                "date_index_list": [ # 数据时间索引值,与数据一一对应
                    "20200606",
                    "20200607",
                    "20200608",
                    "20200609",
                    "20200610"
                ]
            }
        ],
        "message": "success" # 错误消息
    }
    

请求示例

bc 为创建的 RangersClient, 其初始化请参考使用说明,各语言的 SDK 都提供了类似的接口。
调用(Python):

dsl = {
    "version": 3,
    "app_ids": [164***],
    "use_app_cloud_id": True,
    "periods": [
        {
            "granularity": "day",
            "type": "last",
            "last": {
                "amount": 5,
                "unit": "day"
            },
            "timezone": "Asia/Shanghai"
        }
    ],
    "content": {
            "query_type": "event",
            "profile_groups_v2": [],
            "profile_filters": [],
            "queries": [
                [
                    {
                        "event_type": "origin",
                        "show_name": "活跃用户数",
                        "event_name": "app_launch",
                        "groups_v2": [],
                        "filters": [],
                        "show_label": "active_user",
                        "event_indicator": "event_users"
                    }
                ]
            ],
            "option": {
                "skip_cache": False
            }
        }
}

# SaaS 逻辑
resp = bc.data_finder("/openapi/v1/analysis", body=dsl)
print(resp.content)