menu
Is this helpful?

# 间隔分析模型 API

调用方法请参见Open API文档中的调用方法描述。

可阅读使用手册中 间隔分析 了解使用场景。

# 间隔分析查询

接口URL

/open/interval-analyze?token=xxx

请求方式

POST

Content-Type

application/json

请求Query参数

参数名 示例值 参数类型 是否必填 参数描述
token xxx String 查询密钥

# 请求Body参数

{
  "eventView": {
    "endTime": "2021-10-05 23:59:59",
    "filts": [
      {
        "columnDesc": "品牌",
        "columnName": "brand",
        "comparator": "equal",
        "filterType": "SIMPLE",
        "ftv": [
          "苹果",
          "华为"
        ],
        "specifiedClusterDate": "2022-01-24",
        "tableType": "event",
        "timeUnit": ""
      }
    ],
    "groupBy": [
      {
        "columnDesc": "品牌",
        "columnName": "brand",
        "propertyRange": "",
        "specifiedClusterDate": "2022-01-24",
        "tableType": "event"
      }
    ],
    "recentDay": "114-115",
    "relation": "and",
    "startTime": "2021-10-04 00:00:00",
    "taIdMeasureVo": {
      "columnDesc": "用户唯一ID",
      "columnName": "#user_id",
      "tableType": "event"
    },
    "timeParticleSize": "day",
    "windowsGapUnit": "hour",
    "windowsGapValue": 1
  },
  "events": [
    {
      "eventName": "activity_attend",
      "eventNameDisplay": "",
      "filts": [
      ],
      "relation": "and",
      "relationProp": {
        "property": {
          "columnDesc": "品牌",
          "columnName": "brand",
          "specifiedClusterDate": "2022-01-24",
          "tableType": "event"
        }
      },
      "type": "first"
    },
    {
      "eventName": "payment",
      "eventNameDisplay": "",
      "filts": [
      ],
      "relation": "and",
      "relationProp": {
        "property": {
          "columnDesc": "品牌",
          "columnName": "brand",
          "specifiedClusterDate": "2022-01-24",
          "tableType": "event"
        },
        "relationOperatorValue": 0,
        "relationPropNumberOperator": "r_eq"
      },
      "type": "second"
    }
  ],
  "projectId": 377,
  "limit": 10,
  "timeoutSeconds": 10,
  "useCache": true,
  "zoneOffset": 10
}

# 请求参数说明

$$参数名 示例值 参数类型 是否必填 参数描述
eventView - Object 指标公共属性部分
eventView.endTime 2021-10-05 23:59:59 String 结束时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效
eventView.filts - List 全局筛选项
eventView.filts.columnDesc 品牌 String 字段显示名
eventView.filts.columnName brand String 字段名
eventView.filts.comparator equal String 参考: 模型查询API的筛选表达式
eventView.filts.filterType SIMPLE String 过滤模式,SIMPLE:简单,COMPOUND:复合
eventView.filts.ftv ["苹果"] List 用于属性比较边界的字面常量
eventView.filts.specifiedClusterDate 2022-01-24 String 指定对应日期的标签历史版本
eventView.filts.tableType event String 表类型枚举值
eventView.filts.timeUnit String 属性对比值单位,仅对relativeEvent*有效:day,hour,minute
eventView.groupBy - List 分组属性,可以有零个或者多个
eventView.groupBy.columnDesc 品牌 String 字段显示名
eventView.groupBy.columnName brand String 字段名
eventView.groupBy.propertyRange String 自定义属性区间
eventView.groupBy.specifiedClusterDate 2022-01-24 String 指定对应日期的标签历史版本
eventView.groupBy.tableType event String 表类型枚举值
eventView.recentDay 114-115 String 相对时间(此项不可与起始时间和结束时间同时为空)
eventView.relation and String 逻辑关系,and:逻辑与,or:逻辑或
eventView.startTime 2021-10-04 00:00:00 String 起始时间(格式:yyyy-MM-dd HH:mm:ss),相对时间为空时有效
eventView.taIdMeasureVo - Object 分析主体配置
eventView.taIdMeasureVo.columnDesc 用户唯一ID String 字段显示名
eventView.taIdMeasureVo.columnName #user_id String 字段名
eventView.taIdMeasureVo.tableType event String 表类型枚举值
eventView.timeParticleSize day String 分析的时间单位
  • minute:按分钟

  • hour:按小时

  • day:按天

  • week:按周

  • month:按月

  • total:总计

eventView.firstDayOfWeek Integer 当timeParticleSize为week时,指定周首日,1:星期一,2:星期二, ..,7:星期日,最小1,最大7
eventView.windowsGapUnit hour String 窗口时长单位
eventView.windowsGapValue 1 Integer 窗口时长
events - List 事件指标列表
events.eventName activity_attend String 事件名称,特别的,可以使用 anyEvent 表示任意事件
events.eventNameDisplay String 事件显示名
events.filts - List 条件列表列表
events.relation and String 逻辑关系,and:逻辑与,or:逻辑或
events.relationProp - Object 关联属性
events.relationProp.property - Object 关联属性
events.relationProp.property.columnDesc 品牌 String 字段显示名
events.relationProp.property.columnName brand String 字段名
events.relationProp.property.specifiedClusterDate 2022-01-24 String 指定对应日期的标签历史版本
events.relationProp.property.tableType event String 表类型枚举值
events.relationProp.relationOperatorValue 0 Integer 关系操作值
events.relationProp.relationPropNumberOperator r_eq String 关系操作符,
  • r_eq:相等

  • r_high:高

  • r_low:低

events.type first String 事件类型,first:初始事件,second:回访事件
projectId 377 Integer 项目ID
limit 10 Integer 每分析对象的分组数上限,可选参数,默认为1000,最大为10000
timeoutSeconds 10 Integer 请求超时参数,超时则取消查询任务
useCache true Boolean 使用缓存,可选参数,默认为true
zoneOffset 10 Integer 时区

# 成功响应示例

{
  "data": {
    "distributionInterval": [
      ",300",
      "300,600",
      "600,900",
      "900,1200",
      "1200,1500",
      "1500,1800",
      "1800,2100",
      "2100,2400",
      "2400,2700",
      "2700,3000",
      "3000,3300",
      "3300,"
    ],
    "groupCols": [
      [
        "苹果"
      ],
      [
        "华为"
      ]
    ],
    "intervalData": {
      "dateEntities": [
        {
          "dateString": "2021-10-04",
          "groupEntities": [
            {
              "groups": [
                "苹果"
              ],
              "intervalAggValue": {
                "avgValue": 40,
                "eventNum": 6646,
                "maxValue": 354,
                "midValue": 28,
                "minValue": 2,
                "quarterValue": 16,
                "threeQuarterValue": 49,
                "userNum": 838
              },
              "intervalDistributions": [
                {
                  "distribution": "300,600",
                  "intervalDistributionValue": {
                    "eventNum": 5,
                    "userNum": 5
                  }
                },
                {
                  "distribution": ",300",
                  "intervalDistributionValue": {
                    "eventNum": 6641,
                    "userNum": 838
                  }
                }
              ]
            },
            {
              "groups": [
                "华为"
              ],
              "intervalAggValue": {
                "avgValue": 39,
                "eventNum": 5439,
                "maxValue": 313,
                "midValue": 28,
                "minValue": 2,
                "quarterValue": 15,
                "threeQuarterValue": 50,
                "userNum": 683
              },
              "intervalDistributions": [
                {
                  "distribution": "300,600",
                  "intervalDistributionValue": {
                    "eventNum": 2,
                    "userNum": 2
                  }
                },
                {
                  "distribution": ",300",
                  "intervalDistributionValue": {
                    "eventNum": 5437,
                    "userNum": 683
                  }
                }
              ]
            }
          ],
          "intervalAggValue": {
            "avgValue": 39,
            "eventNum": 12085,
            "maxValue": 354,
            "midValue": 28,
            "minValue": 2,
            "quarterValue": 16,
            "threeQuarterValue": 49,
            "userNum": 1520
          },
          "intervalDistributions": [
            {
              "distribution": "300,600",
              "intervalDistributionValue": {
                "eventNum": 7,
                "userNum": 7
              }
            },
            {
              "distribution": ",300",
              "intervalDistributionValue": {
                "eventNum": 12078,
                "userNum": 1520
              }
            }
          ]
        },
        {
          "dateString": "2021-10-05",
          "groupEntities": [
            {
              "groups": [
                "苹果"
              ],
              "intervalAggValue": {
                "avgValue": 39,
                "eventNum": 5700,
                "maxValue": 303,
                "midValue": 28,
                "minValue": 2,
                "quarterValue": 16,
                "threeQuarterValue": 49,
                "userNum": 710
              },
              "intervalDistributions": [
                {
                  "distribution": "300,600",
                  "intervalDistributionValue": {
                    "eventNum": 1,
                    "userNum": 1
                  }
                },
                {
                  "distribution": ",300",
                  "intervalDistributionValue": {
                    "eventNum": 5699,
                    "userNum": 710
                  }
                }
              ]
            },
            {
              "groups": [
                "华为"
              ],
              "intervalAggValue": {
                "avgValue": 40,
                "eventNum": 4779,
                "maxValue": 374,
                "midValue": 28,
                "minValue": 2,
                "quarterValue": 15,
                "threeQuarterValue": 51,
                "userNum": 603
              },
              "intervalDistributions": [
                {
                  "distribution": "300,600",
                  "intervalDistributionValue": {
                    "eventNum": 3,
                    "userNum": 3
                  }
                },
                {
                  "distribution": ",300",
                  "intervalDistributionValue": {
                    "eventNum": 4776,
                    "userNum": 603
                  }
                }
              ]
            }
          ],
          "intervalAggValue": {
            "avgValue": 39,
            "eventNum": 10479,
            "maxValue": 374,
            "midValue": 28,
            "minValue": 2,
            "quarterValue": 16,
            "threeQuarterValue": 50,
            "userNum": 1313
          },
          "intervalDistributions": [
            {
              "distribution": "300,600",
              "intervalDistributionValue": {
                "eventNum": 4,
                "userNum": 4
              }
            },
            {
              "distribution": ",300",
              "intervalDistributionValue": {
                "eventNum": 10475,
                "userNum": 1313
              }
            }
          ]
        }
      ],
      "groupEntities": [
        {
          "groups": [
            "苹果"
          ],
          "intervalAggValue": {
            "avgValue": 39,
            "eventNum": 12346,
            "maxValue": 354,
            "midValue": 28,
            "minValue": 2,
            "quarterValue": 16,
            "threeQuarterValue": 49,
            "userNum": 1542
          },
          "intervalDistributions": [
            {
              "distribution": "300,600",
              "intervalDistributionValue": {
                "eventNum": 6,
                "userNum": 6
              }
            },
            {
              "distribution": ",300",
              "intervalDistributionValue": {
                "eventNum": 12340,
                "userNum": 1542
              }
            }
          ]
        },
        {
          "groups": [
            "华为"
          ],
          "intervalAggValue": {
            "avgValue": 39,
            "eventNum": 10218,
            "maxValue": 374,
            "midValue": 28,
            "minValue": 2,
            "quarterValue": 15,
            "threeQuarterValue": 50,
            "userNum": 1282
          },
          "intervalDistributions": [
            {
              "distribution": "300,600",
              "intervalDistributionValue": {
                "eventNum": 5,
                "userNum": 5
              }
            },
            {
              "distribution": ",300",
              "intervalDistributionValue": {
                "eventNum": 10213,
                "userNum": 1282
              }
            }
          ]
        }
      ],
      "intervalAggValue": {
        "avgValue": 39,
        "eventNum": 22564,
        "maxValue": 374,
        "midValue": 28,
        "minValue": 2,
        "quarterValue": 16,
        "threeQuarterValue": 49,
        "userNum": 2817
      },
      "intervalDistributions": [
        {
          "distribution": "300,600",
          "intervalDistributionValue": {
            "eventNum": 11,
            "userNum": 11
          }
        },
        {
          "distribution": ",300",
          "intervalDistributionValue": {
            "eventNum": 22553,
            "userNum": 2817
          }
        }
      ]
    },
    "intervalType": "def",
    "timeArray": [
      "2021-10-04",
      "2021-10-05"
    ]
  },
  "return_code": 0,
  "return_message": "success"
}

# 响应参数说明

$$参数名 示例值 参数类型 参数描述
return_code 0 Integer 返回码
return_message success String 返回信息
data - Object 返回结果
data.distributionInterval [",300","300,"] List 分布间隔
data.groupCols [["苹果"],["华为"]] List 分组
data.intervalData - Object 日期数据
data.intervalData.dateEntities - List 日期列表
data.intervalData.dateEntities.dateString 2021-10-04 String 日期
data.intervalData.groupEntities - List 分组列表
data.intervalData.groupEntities.groups ["苹果"] List 分组值列表
data.intervalData.intervalAggValue - Object 聚合值
data.intervalData.intervalAggValue.avgValue 39 Long 平均值
data.intervalData.intervalAggValue.eventNum 22564 Long 事件数
data.intervalData.intervalAggValue.maxValue 374 Long 最大值
data.intervalData.intervalAggValue.midValue 28 Long 中位数
data.intervalData.intervalAggValue.minValue 2 Long 最小值
data.intervalData.intervalAggValue.quarterValue 16 Long 上四分位
data.intervalData.intervalAggValue.threeQuarterValue 49 Long 下四分位
data.intervalData.intervalAggValue.userNum 2817 Long 用户数
data.intervalData.intervalDistributions - List 分布区间列表
data.intervalData.intervalDistributions.distribution 300,600 String 分布区间
data.intervalData.intervalDistributions.intervalDistributionValue - Object 分布区间值
data.intervalData.intervalDistributions.intervalDistributionValue.eventNum 11 Long 事件数
data.intervalData.intervalDistributions.intervalDistributionValue.userNum 11 Long 用户数
data.intervalType def String 类型
  • discrete:离散数字

  • def:默认区间

  • user_defined:用户自定义

data.timeArray ["2021-10-04"] List 事件列表

错误响应示例

{
    "return_code": -1008,
    "return_message": "参数(token)为空"
}
参数名 示例值 参数类型 参数描述
return_code -1008 Integer 返回码
return_message 参数(token)为空 String 返回信息

# 间隔分析全量下载

接口URL

/open/streaming-download/interval-analyze?token=xxx

请求方式

POST

Content-Type

application/json

请求Query参数

参数名 示例值 参数类型 是否必填 参数描述
token xxx String 查询密钥

# 请求Body参数

{
        "eventView": {
                "endTime": "2022-03-07 17:17:04",
                "filts": [],
                "groupBy": [],
                "recentDay": "1-7",
                "relation": "and",
                "startTime": "2022-03-01 17:17:04",
                "taIdMeasureVo": {
                        "columnDesc": "User ID",
                        "columnName": "#user_id",
                        "tableType": "event"
                },
                "timeParticleSize": "day",
                "windowsGapUnit": "hour",
                "windowsGapValue": 1
        },
        "events": [{
                "eventName": "Login",
                "eventNameDisplay": "",
                "filts": [],
                "relation": "and",
                "type": "first"
        }, {
                "eventName": "Recharge",
                "eventNameDisplay": "",
                "filts": [],
                "relation": "and",
                "type": "second"
        }],
        "projectId": 319,
        "format": "AGG_TABLE",
        "zoneOffset": 10
}

# 请求参数说明

$$参数名 示例值 参数类型 是否必填 参数描述
eventView - Object 分组属性
events - List 事件指标列表
projectId 377 Integer 项目ID
format AGG_TABLE String AGG_TABLE 何须图转换表格 DISTRIBUTION_TABLE 转换分布表格
interval [1] array 全部区间
zoneOffset 10 Integer 时区

# 响应

同TE系统间隔分析全量下载

# 间隔分析用户列表

接口URL

/open/interval-user-list?token=xxx

请求方式

POST

Content-Type

application/json

请求Query参数

参数名 示例值 参数类型 是否必填 参数描述
token xxx String 查询密钥

# 请求Body参数

{
  "eventView": {
    "endTime": "2021-10-05 23:59:59",
    "filts": [
      {
        "columnDesc": "品牌",
        "columnName": "brand",
        "comparator": "equal",
        "filterType": "SIMPLE",
        "ftv": [
          "苹果",
          "华为"
        ],
        "specifiedClusterDate": "2022-01-24",
        "tableType": "event",
        "timeUnit": ""
      }
    ],
    "groupBy": [
      {
        "columnDesc": "品牌",
        "columnName": "brand",
        "propertyRange": "",
        "specifiedClusterDate": "2022-01-24",
        "tableType": "event"
      }
    ],
    "recentDay": "114-115",
    "relation": "and",
    "startTime": "2021-10-04 00:00:00",
    "taIdMeasureVo": {
      "columnDesc": "用户唯一ID",
      "columnName": "#user_id",
      "tableType": "event"
    },
    "timeParticleSize": "day",
    "windowsGapUnit": "hour",
    "windowsGapValue": 1
  },
  "events": [
    {
      "eventName": "activity_attend",
      "eventNameDisplay": "",
      "filts": [
      ],
      "relation": "and",
      "relationProp": {
        "property": {
          "columnDesc": "品牌",
          "columnName": "brand",
          "specifiedClusterDate": "2022-01-24",
          "tableType": "event"
        }
      },
      "type": "first"
    },
    {
      "eventName": "payment",
      "eventNameDisplay": "",
      "filts": [
      ],
      "relation": "and",
      "relationProp": {
        "property": {
          "columnDesc": "品牌",
          "columnName": "brand",
          "specifiedClusterDate": "2022-01-24",
          "tableType": "event"
        },
        "relationOperatorValue": 0,
        "relationPropNumberOperator": "r_eq"
      },
      "type": "second"
    }
  ],
  "projectId": 377,
  "timeoutSeconds": 10,
  "interval": "2,3",
  "sliceDate": "",
  "sliceGroupVal": ["苹果", "华为"],
  "zoneOffset": 10
}

# 请求参数说明

$$参数名 示例值 参数类型 是否必填 参数描述
eventView - Object 参数内容与间隔分析查询接口一致
events - List 参数内容与间隔分析查询接口一致
projectId 377 Integer 项目ID
timeoutSeconds 10 Integer 请求超时参数,超时则取消查询任务
interval 2,3 String 哪个区间进行下钻
sliceDate 2021-10-21 String 哪个日期进行下钻
sliceGroupVal ["苹果", "华为"] List 哪个分组进行下钻
zoneOffset 10 Integer 时区

# 成功响应示例

{
  "data": {
    "columMeta": {
      "country": "国家",
      "education": "学历",
      "birthdate": "出生日期",
      "gender": "性别",
      "last_login_time": "last_login_time",
      "city": "城市",
      "nation": "民族",
      "channel": "用户操作类型",
      "weight": "体重(KG)",
      "#distinct_id": "访客ID",
      "firstcharge": "是否首充",
      "register_time": "register_time",
      "#account_id": "账户ID",
      "companynature": "工作单位性质",
      "accountbalance": "余额",
      "maritalstatus": "婚姻状况",
      "interest": "兴趣爱好",
      "name": "姓名",
      "accountpoint": "积分项",
      "rank": "会员等级",
      "first_login_time": "first_login_time",
      "email": "邮箱",
      "height": "身高(CM)"
    },
    "datalist": [
      {
        "country": "中国",
        "birthdate": "2013-05-21",
        "education": "大专",
        "last_login_time": "2021-12-04 02:18:46.111",
        "gender": "男",
        "city": "上海市",
        "nation": "汉族",
        "#user_id": 795692987887919100,
        "channel": "微信",
        "weight": "125",
        "#distinct_id": "5694fdd8-e1dc-4459-97dd-33b10df01400",
        "firstcharge": false,
        "register_time": "2021-10-06 00:00:23.000",
        "#account_id": "b406f8a7-424d-4909-a08a-7b00191b7493",
        "companynature": "国有企业",
        "accountbalance": "42606",
        "maritalstatus": "未婚",
        "interest": [
          "旅行",
          "运动",
          "运动"
        ],
        "accountpoint": "81910",
        "name": "UaLEhzdn",
        "rank": "金卡",
        "first_login_time": "2021-10-06 00:01:56.000",
        "email": "ElqqXwdL@thinkingdata.cn",
        "height": "174"
      },
      {
        "country": "中国",
        "birthdate": "1964-12-26",
        "education": "大专",
        "last_login_time": "2021-10-05 00:02:35.000",
        "gender": "男",
        "city": "上海市",
        "nation": "汉族",
        "#user_id": 795692395992715300,
        "channel": "官网",
        "weight": "197",
        "#distinct_id": "5caf9f1a-3253-4279-9723-49c950a48020",
        "firstcharge": true,
        "register_time": "2021-10-05 00:00:30.000",
        "#account_id": "cb6ab625-f45d-4977-bbae-973ead82acba",
        "companynature": "外资",
        "accountbalance": "49013",
        "maritalstatus": "未婚",
        "interest": [
          "运动",
          "唱歌",
          "运动"
        ]
    ],
    "totalNum": 2
  },
  "return_code": 0,
  "return_message": "success"
}

# 响应参数说明

$$参数名 示例值 参数类型 参数描述
return_code 0 Integer 返回码
return_message success String 返回信息
data - Object 返回结果
data.datalist - List 用户信息
data.columMeta - Map 字段含义映射
data.totalNum 2 Integer 总数

错误响应示例

{
    "return_code": -1008,
    "return_message": "参数(token)为空"
}
参数名 示例值 参数类型 参数描述
return_code -1008 Integer 返回码
return_message 参数(token)为空 String 返回信息

# 间隔分析用户列表下载

接口URL

/open/streaming-download/interval-user-list?token=xxx

请求方式

POST

Content-Type

application/json

请求Query参数

参数名 示例值 参数类型 是否必填 参数描述
token xxx String 查询密钥

# 请求Body参数

{
    "eventView": {
        "endTime": "2022-03-07 17:17:04",
        "filts": [],
        "groupBy": [],
        "recentDay": "1-7",
        "relation": "and",
        "startTime": "2022-03-01 17:17:04",
        "taIdMeasureVo": {
            "columnDesc": "User ID",
            "columnName": "#user_id",
            "tableType": "event"
        },
        "timeParticleSize": "day",
        "windowsGapUnit": "hour",
        "windowsGapValue": 1
    },
    "events": [
        {
            "eventName": "Login",
            "eventNameDisplay": "",
            "filts": [],
            "relation": "and",
            "type": "first"
        },
        {
            "eventName": "Recharge",
            "eventNameDisplay": "",
            "filts": [],
            "relation": "and",
            "type": "second"
        }
    ],
    "projectId": 319,
    "sliceGroupVal": null,
    "sliceDate": "2022-03-01",
    "selectedColumns": [
        "#account_id",
        "#distinct_id",
        "accountid"
    ],
    "zoneOffset": 10
}

# 请求参数说明

$$参数名 示例值 参数类型 是否必填 参数描述
eventView - Object 参数内容与间隔分析查询接口一致
events - List 参数内容与间隔分析查询接口一致
projectId 377 Integer 项目ID
selectedColumns ["#account_id"] array 需要下载的项
interval 2,3 String 哪个区间进行下钻
sliceDate 2021-10-21 String 哪个日期进行下钻
sliceGroupVal ["苹果", "华为"] List 哪个分组进行下钻
zoneOffset 10 Integer 时区

# 响应

同TA系统间隔分析用户列表下载