身份验证
鉴权依据
API ID、API Secret
注:由于数据敏感,所以只在主账号中可见,具体展示位置为:
“管理控制台”--〉“采集信息”
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.platforms
请求参数构建
DEMO
{
"appCodes": [
"al1",
"al2"
]
}
字段名称 | 字段含义 | 是否必填 | 备注 |
appCodes | 应用编码列表 | 必填 |
返回结果
{
"code": 200,
"msg": "SUCCESS",
"sCode": 200,
"sMsg": "SUCCESS",
"data": {
"platforms": [
{
"appCode": "al1",
"oldAppId": "gara56wamswjbnsbbc3h8o5m@wx",
"platformType": "WX",
"appkey": "gara56wamswjbnsbbc3h8o5m",
"integrationStatus": 1,
"platformId": 97752207052472,
"platformName": "al",
"gmtCreate": "2022-07-05 16:32:55"
},
{
"appCode": "al2",
"oldAppId": "r1puw2hbot7i3mak990qsk1c@pc",
"platformType": "PC",
"appkey": "r1puw2hbot7i3mak990qsk1c",
"integrationStatus": 1,
"platformId": 32892207052521,
"platformName": "123141_PC",
"gmtCreate": "2022-07-05 17:03:18"
},
{
"appCode": "al2",
"oldAppId": "r1puw2hbot7i3mak990qsk1c@wap",
"platformType": "WAP",
"appkey": "r1puw2hbot7i3mak990qsk1c",
"integrationStatus": 1,
"platformId": 47322207054943,
"platformName": "123141_WAP",
"gmtCreate": "2022-07-05 17:03:18"
}
]
},
"traceId": "5328c592cdcb4a0e9bb1b22fda3c8f7d",
"success": true
}
platforms.appCode | 应用编码 |
platforms.appkey | appkey |
platforms.platformType | 平台类型 |
platforms.platformName | 平台名称 |
platforms.integrationStatus | 集成状态,0:未集成,1:已集成 |
文档内容是否对您有帮助?