创建应用

身份验证

鉴权依据

API ID、API Secret

注:由于数据敏感,所以只在主账号中可见,具体展示位置为:

“管理控制台”--〉“采集信息”image.png

URL参数

http://{yourDomain}/api/{service}?api_id=abcdef&api_sign=abcdef&api_ts=123456

参数名

描述

备注

api_id

API ID

Quick Tracking后台主账号可查看

api_sign

签名

具体逻辑见“鉴权签名”

api_ts

时间戳

毫秒

body参数

{
    "dataSourceId": "32772108106530",
    "reportId":"rh2m151qj7bmh67uiqv46il4vfn8vckc",
    "timeUnit":"day",
    "fromDate":"2021-12-01",
    "toDate": "2021-12-23"
}

鉴权签名

方法名 + 参数按照key进行字母排序

/**
 * Quick Tracking后台主账号可查看
 */
String secret = "abcdef";

/**
 * 当前要请求的服务名
 */
String service = "analysis.report.data";

/**
 * 1.获取url参数,如apiId=abcdef&sign=abcdef&ts=123456
 * 2.按照key排序,移除sign,结果apiId=abcdef&ts=123456
 */
String queryString = sort("api_id=abcdef&api_ts=123456");

/**
 * POST接口,body内容
 */
String bodyString = "{
    "dataSourceId": "32772108106530",
    "reportId":"rh2m151qj7bmh67uiqv46il4vfn8vckc",
    "timeUnit":"day",
    "fromDate":"2021-12-01",
    "toDate": "2021-12-23"
}";

String source = service
    + "\n" 
    + queryString
    + "\n"
    + bodyString;

用API Secret对source进行加密

String sign = new HmacUtils(HmacAlgorithms.HMAC_SHA_1, secret).hmacHex(source);

sign = 1cfc10a297397e91f1e50e1f41ac24b8c45fd53d

<dependency>
  <groupId>com.squareup.okhttp3</groupId>
  <artifactId>okhttp</artifactId>
  <version>3.3.0</version>
</dependency>

service

system.app.create

请求参数构建

DEMO(APP、MINI_APP)

{
    "appName": "open_api_test_002",
    "bizDomain": "other",
    "appCode": "open_api_test_002",
    "ownerId": 75142102232654,
    "orgId": 75782206263334,
    "platform": [
        {
            "platformType": "ANDROID",
            "platformName": "Android"
        }
    ],
    "ownerName": "SuperAdmin",
    "appType": "APP",
    "appDesc": "open_api_test_002"
}

DEMO(WEB)

{
  "ownerName": "SuperAdmin",
  "appName": "open_api_test_006",
  "appType": "WEB",
  "appDesc": "open_api_test_006",
  "bizDomain": "other",
  "webDomain": "www.umeng.com",
  "appCode": "open_api_test_006",
  "ownerId": 75142102232654,
  "orgId": 75782206263334
}

字段名称

字段含义

是否必填

备注

orgId

归属组织

必填

bizDomain

行业类型

必填

参考行业类型表格

appCode

应用编码

必填

appName

应用名称

必填

appDesc

应用描述

必填

appType

应用类型

必填

APP、WEB、MINI_APP

webDomain

网页域名

非必填

当appType == 'WEB'时,必填

ownerId

应用负责人ID

必填

ownerName

应用负责人名称

必填

platform.platformType

平台类型

必填

参考平台类型表格

platform.appkey

appkey

非必填

如未填,系统自动生成

如自定义,随机24位字符串,不重复

platform.platformName

平台名称

必填

行业类型

[
  {
    "bizId": 437,
    "bizName": "保险",
    "bizCode": "insurance"
  },
  {
    "bizId": 3523,
    "bizName": "地产",
    "bizCode": "estate"
  },
  {
    "bizId": 205,
    "bizName": "工具",
    "bizCode": "utilities"
  },
  {
    "bizId": 202,
    "bizName": "购物",
    "bizCode": "shopping"
  },
  {
    "bizId": 204,
    "bizName": "旅游",
    "bizCode": "travel"
  },
  {
    "bizId": 9340,
    "bizName": "媒体",
    "bizCode": "media"
  },
  {
    "bizId": 208,
    "bizName": "美食佳饮",
    "bizCode": "food_drink"
  },
  {
    "bizId": 9981,
    "bizName": "品牌零售",
    "bizCode": "brand-retail"
  },
  {
    "bizId": 2940,
    "bizName": "企业服务",
    "bizCode": "company-service"
  },
  {
    "bizId": 2876,
    "bizName": "汽车",
    "bizCode": "car"
  },
  {
    "bizId": 209,
    "bizName": "商务",
    "bizCode": "business"
  },
  {
    "bizId": 207,
    "bizName": "生活",
    "bizCode": "lifestyle"
  },
  {
    "bizId": 2130,
    "bizName": "物流",
    "bizCode": "logistics"
  },
  {
    "bizId": 1760,
    "bizName": "消费金融",
    "bizCode": "consumer-finance"
  },
  {
    "bizId": 3218,
    "bizName": "银行",
    "bizCode": "bank"
  },
  {
    "bizId": 4314,
    "bizName": "游戏",
    "bizCode": "game"
  },
  {
    "bizId": 203,
    "bizName": "娱乐",
    "bizCode": "entertainment"
  },
  {
    "bizId": 18,
    "bizName": "证券",
    "bizCode": "securities"
  },
  {
    "bizId": 308,
    "bizName": "政务",
    "bizCode": "government-affairs"
  },
  {
    "bizId": 201,
    "bizName": "其他",
    "bizCode": "other"
  }
]

平台类型

应用类型

平台类型

展示名称

APP

ANDROID

Android

APP

IPHONEOS

iOS

APP

HARMONY

Harmony

WEB

PC

默认

MINI_APP

WX

微信小程序

MINI_APP

MY

支付宝小程序

MINI_APP

TAOBAO

淘宝小程序

MINI_APP

BD

百度小程序

MINI_APP

DD

钉钉小程序

MINI_APP

TT

字节跳动小程序

返回结果

{
  "code": 200,
  "msg": "SUCCESS",
  "sCode": 200,
  "sMsg": "SUCCESS",
  "traceId": "b66df3b41a8a44e8ac059a71c305ef26",
  "success": true
}