# 分布分析模型 API
调用方法请参见Open API文档中的调用方法描述。
可阅读使用手册中 分布分析 了解使用场景。
# 分布分析查询
接口URL
/open/distribution-analyze?token=xxx
请求方式
POST
Content-Type
application/json
请求Query参数
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
token | xxx | String | 是 | token |
# 请求Body参数
{
"eventView":{
"endTime":"2021-10-05 23:59:59",
"groupBy":[
{
"columnDesc":"学历",
"columnName":"education",
"propertyRange":"",
"specifiedClusterDate":"2022-01-24",
"tableType":"user"
},
{
"columnDesc":"城市",
"columnName":"city",
"propertyRange":"",
"specifiedClusterDate":"2022-01-24",
"tableType":"user"
}],
"recentDay":"114-115",
"startTime":"2021-10-04 00:00:00",
"taIdMeasureVo":{
"columnDesc":"用户唯一ID",
"columnName":"#user_id",
"tableType":"event"
},
"timeParticleSize":"day"
},
"events":[
{
"customEvent":"activity_attend.TIMES",
"customFilters":[
],
"eventName":"自定义指标",
"eventNameDisplay":"",
"filts":[
{
"columnDesc":"城市",
"columnName":"city",
"comparator":"equal",
"filterType":"SIMPLE",
"ftv":[
"北京市",
"上海市",
"广州市",
"深圳市"],
"specifiedClusterDate":"2022-01-27",
"tableType":"user",
"timeUnit":""
}],
"formulation":{
"formulationDeps":[
{
"event":{
"eventDesc":"参加活动",
"eventName":"activity_attend"
}
}]
},
"intervalType":"user_defined",
"quota":"",
"quotaIntervalArr":[
500],
"relation":"and",
"type":"customized"
},
{
"analysis":"TOTAL_TIMES",
"analysisDesc":"总次数",
"eventName":"payment",
"eventNameDisplay":"",
"filts":[
],
"intervalType":"def",
"quota":"",
"relation":"and",
"type":"normal"
}],
"projectId":377,
"limit": 2,
"timeoutSeconds": 10,
"useCache": true
}
# 请求参数说明
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
eventView | - | Object | 是 | 分组属性 |
∟ endTime | 2021-10-05 23:59:59 | String | 否 | 结束时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效 |
∟ groupBy | - | List | 否 | 分组属性,可以有零个或者多个 |
∟ columnDesc | 学历 | String | 否 | 字段显示名 |
∟ columnName | education | String | 是 | 字段名 |
∟ propertyRange | String | 否 | 自定义属性区间 | |
∟ specifiedClusterDate | 2022-01-24 | String | 否 | 集群指定日期 |
∟ tableType | user | String | 是 | 表类型,event:事件表,user:用户表 |
∟ recentDay | 114-115 | String | 否 | 相对时间(此项不可与起始时间和结束时间同时为空) |
∟ startTime | 2021-10-04 00:00:00 | String | 否 | 起始时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效 |
∟ taIdMeasureVo | - | Object | 否 | 分析主体配置 |
∟ columnDesc | 用户唯一ID | String | 否 | 字段显示名 |
∟ columnName | #user_id | String | 是 | 字段名 |
∟ tableType | event | String | 是 | 表类型,event:事件表,user:用户表 |
∟ timeParticleSize | day | String | 是 | 分析的时间单位 minute:按1分钟 minute5:按5分钟(v3.5开始支持) minute10:按10分钟(v3.5开始支持) hour:按小时 day:按天 week:按周 month:按月 total:总计 |
events | - | List | 是 | 事件指标列表 |
∟ analysis | TOTAL_TIMES | String | 否 | 分析角度,具体见下表 |
∟ analysisDesc | 总次数 | String | 否 | 分析角度描述(显示名) |
∟ customEvent | activity_attend.TIMES | String | 否 | 自定义事件 |
∟ customFilters | [] | List | 否 | 自定义事件过滤 |
∟ eventName | login | String | 是 | 事件名称,特别的,可以使用 anyEvent 表示任意事件 |
∟ eventNameDisplay | String | 否 | 事件显示名 | |
∟ filts | - | List | 否 | 条件列表列表 |
∟ columnDesc | 城市 | String | 否 | 字段显示名 |
∟ columnName | city | String | 是 | 字段名称 |
∟ comparator | equal | String | 是 | 参考: 模型查询API的筛选表达式 |
∟ filterType | SIMPLE | String | 否 | 过滤模式,SIMPLE:简单,COMPOUND:复合 |
∟ ftv | ["北京市"] | List | 否 | 属性对比值 |
∟ specifiedClusterDate | 2022-01-27 | String | 否 | 集群指定日期 |
∟ tableType | user | String | 是 | 表类型,event:事件表,user:用户表 |
∟ timeUnit | String | 否 | 过滤时间单位 | |
∟ formulation | - | Object | 否 | 新公式实体 |
∟ formulationDeps | - | List | 否 | 公式依赖 |
∟ event | - | Object | 否 | 依赖事件 |
∟ eventDesc | 参加活动 | String | 否 | 事件显示名 |
∟ eventName | activity_attend | String | 是 | 事件名称 |
∟ intervalType | user_defined | String | 否 | 区间间隔类型 discrete:离散数字 def:默认区间 user_defined:用户自定义 |
∟ quota | String | 否 | 指标属性 | |
∟ quotaIntervalArr | [500] | List | 否 | 指标区间 |
∟ relation | and | String | 否 | 逻辑关系,and:逻辑与,or:逻辑或 |
∟ type | normal | String | 是 | 指标类型, normal:正 customized:自定义 |
projectId | 0 | Integer | 是 | 项目ID |
limit | 2 | Integer | 否 | 每分析对象的分组数上限,可选参数,默认为1000,最大为10000 |
timeoutSeconds | 10 | Integer | 否 | 请求超时参数,超时则取消查询任务 |
useCache | true | Boolean | 否 | 使用缓存,可选参数,默认为true |
分布分析聚合方法 analysis 取值:
值 | 描述 | 是否需要属性 |
---|---|---|
TIMES | 次数 | 否 |
NUMBER_OF_DAYS | 天数 | 否 |
NUMBER_OF_HOURS | 小时数 | 否 |
SUM | 数值总和 | 是 |
AVG | 数值平均值 | 是 |
MAX | 数值最大值 | 是 |
MIN | 数值最小值 | 是 |
DISTINCT | 去重数 | 是 |
TRUE | 为真数 | 是 |
FALSE | 为假数 | 是 |
IS_NOT_EMPTY | 不为空数 | 是 |
IS_EMPTY | 为空数 | 是 |
ARRAY_DISTINCT | 列表整体去重数 | 是 |
ARRAY_SET_DISTINCT | 元素集合去重数 | 是 |
ARRAY_ITEM_DISTINCT | 列表元素去重数 | 是 |
MEDIAN | 中位数 | 是 |
# 成功响应示例
{
"data": {
"distribution_interval": [
",500",
"500,"
],
"result_generate_time": "2022-01-27 11:25:44",
"x": [
"2021-10-04",
"2021-10-05"
],
"y": {
"2021-10-04": [
{
"groupCols": [
"总体",
"总体"
],
"isTotal": 1,
"meanwhileValues": [
"28249",
"-"
],
"totalMeanwhileValue": "28249",
"totalUserNum": 1722,
"values": [
1722,
0
]
},
{
"groupCols": [
"其他",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"3842",
"-"
],
"totalMeanwhileValue": "3842",
"totalUserNum": 235,
"values": [
235,
0
]
},
{
"groupCols": [
"大专",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"2421",
"-"
],
"totalMeanwhileValue": "2421",
"totalUserNum": 154,
"values": [
154,
0
]
},
{
"groupCols": [
"其他",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"2518",
"-"
],
"totalMeanwhileValue": "2518",
"totalUserNum": 151,
"values": [
151,
0
]
},
{
"groupCols": [
"其他",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"2355",
"-"
],
"totalMeanwhileValue": "2355",
"totalUserNum": 142,
"values": [
142,
0
]
},
{
"groupCols": [
"其他",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"1906",
"-"
],
"totalMeanwhileValue": "1906",
"totalUserNum": 116,
"values": [
116,
0
]
},
{
"groupCols": [
"大专",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"1738",
"-"
],
"totalMeanwhileValue": "1738",
"totalUserNum": 107,
"values": [
107,
0
]
},
{
"groupCols": [
"本科",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"1720",
"-"
],
"totalMeanwhileValue": "1720",
"totalUserNum": 106,
"values": [
106,
0
]
},
{
"groupCols": [
"大专",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"1658",
"-"
],
"totalMeanwhileValue": "1658",
"totalUserNum": 101,
"values": [
101,
0
]
},
{
"groupCols": [
"本科",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"1595",
"-"
],
"totalMeanwhileValue": "1595",
"totalUserNum": 96,
"values": [
96,
0
]
},
{
"groupCols": [
"研究生",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"1315",
"-"
],
"totalMeanwhileValue": "1315",
"totalUserNum": 78,
"values": [
78,
0
]
},
{
"groupCols": [
"本科",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"1276",
"-"
],
"totalMeanwhileValue": "1276",
"totalUserNum": 75,
"values": [
75,
0
]
},
{
"groupCols": [
"大专",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"1207",
"-"
],
"totalMeanwhileValue": "1207",
"totalUserNum": 75,
"values": [
75,
0
]
},
{
"groupCols": [
"研究生",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"1032",
"-"
],
"totalMeanwhileValue": "1032",
"totalUserNum": 63,
"values": [
63,
0
]
},
{
"groupCols": [
"本科",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"796",
"-"
],
"totalMeanwhileValue": "796",
"totalUserNum": 49,
"values": [
49,
0
]
},
{
"groupCols": [
"研究生",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"678",
"-"
],
"totalMeanwhileValue": "678",
"totalUserNum": 42,
"values": [
42,
0
]
},
{
"groupCols": [
"研究生",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"674",
"-"
],
"totalMeanwhileValue": "674",
"totalUserNum": 38,
"values": [
38,
0
]
},
{
"groupCols": [
"博士",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"514",
"-"
],
"totalMeanwhileValue": "514",
"totalUserNum": 33,
"values": [
33,
0
]
},
{
"groupCols": [
"博士",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"361",
"-"
],
"totalMeanwhileValue": "361",
"totalUserNum": 21,
"values": [
21,
0
]
},
{
"groupCols": [
"博士",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"327",
"-"
],
"totalMeanwhileValue": "327",
"totalUserNum": 20,
"values": [
20,
0
]
},
{
"groupCols": [
"博士",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"316",
"-"
],
"totalMeanwhileValue": "316",
"totalUserNum": 20,
"values": [
20,
0
]
}
],
"2021-10-05": [
{
"groupCols": [
"总体",
"总体"
],
"isTotal": 1,
"meanwhileValues": [
"24907",
"-"
],
"totalMeanwhileValue": "24907",
"totalUserNum": 1503,
"values": [
1503,
0
]
},
{
"groupCols": [
"其他",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"3535",
"-"
],
"totalMeanwhileValue": "3535",
"totalUserNum": 221,
"values": [
221,
0
]
},
{
"groupCols": [
"其他",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"2833",
"-"
],
"totalMeanwhileValue": "2833",
"totalUserNum": 162,
"values": [
162,
0
]
},
{
"groupCols": [
"大专",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"2183",
"-"
],
"totalMeanwhileValue": "2183",
"totalUserNum": 130,
"values": [
130,
0
]
},
{
"groupCols": [
"其他",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"1946",
"-"
],
"totalMeanwhileValue": "1946",
"totalUserNum": 116,
"values": [
116,
0
]
},
{
"groupCols": [
"其他",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"1743",
"-"
],
"totalMeanwhileValue": "1743",
"totalUserNum": 109,
"values": [
109,
0
]
},
{
"groupCols": [
"本科",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"1753",
"-"
],
"totalMeanwhileValue": "1753",
"totalUserNum": 107,
"values": [
107,
0
]
},
{
"groupCols": [
"大专",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"1606",
"-"
],
"totalMeanwhileValue": "1606",
"totalUserNum": 92,
"values": [
92,
0
]
},
{
"groupCols": [
"本科",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"1421",
"-"
],
"totalMeanwhileValue": "1421",
"totalUserNum": 81,
"values": [
81,
0
]
},
{
"groupCols": [
"本科",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"1093",
"-"
],
"totalMeanwhileValue": "1093",
"totalUserNum": 68,
"values": [
68,
0
]
},
{
"groupCols": [
"研究生",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"1037",
"-"
],
"totalMeanwhileValue": "1037",
"totalUserNum": 65,
"values": [
65,
0
]
},
{
"groupCols": [
"大专",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"947",
"-"
],
"totalMeanwhileValue": "947",
"totalUserNum": 59,
"values": [
59,
0
]
},
{
"groupCols": [
"大专",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"963",
"-"
],
"totalMeanwhileValue": "963",
"totalUserNum": 58,
"values": [
58,
0
]
},
{
"groupCols": [
"研究生",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"698",
"-"
],
"totalMeanwhileValue": "698",
"totalUserNum": 42,
"values": [
42,
0
]
},
{
"groupCols": [
"本科",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"608",
"-"
],
"totalMeanwhileValue": "608",
"totalUserNum": 39,
"values": [
39,
0
]
},
{
"groupCols": [
"研究生",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"560",
"-"
],
"totalMeanwhileValue": "560",
"totalUserNum": 37,
"values": [
37,
0
]
},
{
"groupCols": [
"研究生",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"553",
"-"
],
"totalMeanwhileValue": "553",
"totalUserNum": 31,
"values": [
31,
0
]
},
{
"groupCols": [
"博士",
"北京市"
],
"isTotal": 0,
"meanwhileValues": [
"478",
"-"
],
"totalMeanwhileValue": "478",
"totalUserNum": 29,
"values": [
29,
0
]
},
{
"groupCols": [
"博士",
"广州市"
],
"isTotal": 0,
"meanwhileValues": [
"353",
"-"
],
"totalMeanwhileValue": "353",
"totalUserNum": 22,
"values": [
22,
0
]
},
{
"groupCols": [
"博士",
"上海市"
],
"isTotal": 0,
"meanwhileValues": [
"339",
"-"
],
"totalMeanwhileValue": "339",
"totalUserNum": 19,
"values": [
19,
0
]
},
{
"groupCols": [
"博士",
"深圳市"
],
"isTotal": 0,
"meanwhileValues": [
"258",
"-"
],
"totalMeanwhileValue": "258",
"totalUserNum": 16,
"values": [
16,
0
]
}
]
}
},
"return_code": 0,
"return_message": "success"
}
# 响应参数说明
参数名 | 示例值 | 参数类型 | 参数描述 |
---|---|---|---|
return_code | 0 | Integer | 返回码 |
return_message | success | String | 返回信息 |
data | - | Object | 返回结果 |
∟ distribution_interval | [",500","500,"] | List | 分布间隔 |
∟ result_generate_time | 2022-01-27 11:25:44 | String | 结果生成时间 |
∟ x | ["2021-10-04"] | List | x轴信息 |
∟ y | - | List | y轴信息 |
错误响应示例
{
"return_code": -1008,
"return_message": "参数(token)为空"
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|---|---|---|
return_code | -1008 | Integer | 返回码 |
return_message | 参数(token)为空 | String | 返回信息 |
# 分布分析用户列表
接口URL
/open/distribution-user-list?token=xxx
请求方式
POST
Content-Type
application/json
请求Query参数
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
token | xxx | String | 是 | token |
# 请求Body参数
{
"projectId": 0,
"eventView": {
"startTime": "2019-10-28 00:00:00",
"endTime": "2019-11-26 00:00:00",
"recentDay": "D31",
"timeParticleSize": "week",
"groupBy": [
{
"columnName": "#province",
"tableType": "event"
}
]
},
"events": [{
"analysis": "TIMES",
"eventName": "consume_item",
"intervalType": "def",
"quota": "",
"relation": "and",
"filts": [
{
"columnName": "#os",
"comparator": "equal",
"ftv": [
"android"
],
"tableType": "event"
}
]
}],
"interval": "10,20",
"sliceDate": "2019-11-18",
"sliceGroupVal": ["北京市"],
"timeoutSeconds": 10
}
# 请求参数说明
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|---|---|---|---|
projectId | 0 | String | 是 | 参数描述 |
eventView | - | Object | 是 | 分组属性表 |
∟ startTime | 2019-10-28 00:00:00 | String | 否 | 起始时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效 |
∟ endTime | 2019-11-26 00:00:00 | String | 否 | 结束时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效 |
∟ recentDay | D31 | String | 否 | 相对时间(此项不可与起始时间和结束时间同时为空) |
∟ timeParticleSize | week | String | 是 | 分析的时间单位 minute:按1分钟 minute5:按5分钟(v3.5开始支持) minute10:按10分钟(v3.5开始支持) hour:按小时 day:按天 week:按周 month:按月 total:总计 |
∟ groupBy | - | List | 否 | 分组属性,可以有零个或者多个 |
∟ columnName | #city | String | 是 | 字段名 |
∟ tableType | event | String | 是 | 表类型,event:事件表,user:用户表 |
events | List | 是 | 事件指标列表 | |
∟ eventName | consume_item | String | 是 | 事件名称,特别的,可以使用 anyEvent 表示任意事件 |
∟ analysis | TIMES | String | 否 | 分析类型,聚合操作,具体见下表 |
∟ quota | String | 否 | 指标属性(配合analysis,意思是哪个属性的哪个分析角度) | |
∟ relation | and | String | 否 | 逻辑关系,and:逻辑与,or:逻辑或 |
∟ intervalType | def | String | 是 | discrete:离散数字 def:默认区间 user_defined:用户自定义 |
∟ filts | - | List | 否 | 筛选项列表 |
∟ columnName | #os | String | 是 | 字段名称 |
∟ comparator | equal | String | 是 | 参考: 模型查询API的筛选表达式 |
∟ ftv | ["android"] | List | 否 | 属性对比值 |
∟ tableType | event | String | 是 | 表类型,event:事件表,user:用户表 |
interval | 10,20 | String | 否 | [10,20)小时 |
sliceDate | "2019-11-18" | String | 否 | 2019-11-18当周 |
sliceGroupVal | ["北京市"] | String | 是 | 事件所在分组 |
timeoutSeconds | 10 | Integer | 否 | 请求超时参数,超时则取消查询任务 |
# 成功响应示例
{
"data": {
"datalist": [
{
"#account_id": "h7784497",
"#distinct_id": "h14456917",
"user_level": 13,
"register_time": "2019-11-24 21:52:38",
"diamond_num": 1201,
"latest_login_time": "2019-11-24 23:35:49",
"channel": "百度手机助手",
"#user_id": 3336217
},
{
"#account_id": "h6201359",
"#distinct_id": "h11516759",
"user_level": 68,
"register_time": "2019-06-23 09:25:18",
"diamond_num": 1686,
"first_recharge_time": "2019-06-23 09:25:38",
"latest_login_time": "2019-11-18 23:01:49",
"channel": "华为应用市场",
"#user_id": 2657759
},
{
"#account_id": "g4102426",
"#distinct_id": "g7618786",
"user_level": 47,
"register_time": "2019-07-29 13:58:23",
"diamond_num": 1,
"first_recharge_time": "2019-07-29 15:42:20",
"latest_login_time": "2019-11-24 16:04:03",
"channel": "应用宝",
"#user_id": 1758186
}
],
"columMeta": {
"#account_id": "账户ID",
"#distinct_id": "访客ID",
"user_level": "用户等级",
"register_time": "注册时间",
"diamond_num": "当前拥有钻石数",
"first_recharge_time": "首次充值时间",
"latest_login_time": "最后登录时间",
"channel": "渠道"
}
},
"return_code": 0,
"return_message": "success"
}
# 响应参数说明
参数名 | 示例值 | 参数类型 | 参数描述 |
---|---|---|---|
return_code | 0 | Integer | 返回码 |
return_message | success | String | 返回信息 |
data | - | Object | 返回结果 |
∟ datalist | - | List | 用户信息 |
∟ columMeta | - | Map | 字段含义映射 |
错误响应示例
{
"return_code": -1008,
"return_message": "参数(token)为空"
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|---|---|---|
return_code | -1008 | Integer | 返回码 |
return_message | 参数(token)为空 | String | 返回信息 |
← 漏斗分析模型 API 路径分析模型 API →