测试接口
增量测试
接口共包含5条数据,含时间戳和软删除标记,可用于测试增量同步效果
id | created_at | updated_at | deleted_mark | userId | name |
---|---|---|---|---|---|
1 | 2023-01-01 00:00:00 | 2023-01-01 00:00:00 | 0 | dingyi | 丁一 |
2 | 2023-01-01 00:00:00 | 2023-01-02 00:00:00 | 0 | qianer | 钱二 |
3 | 2023-01-01 00:00:00 | 2023-01-03 00:00:00 | 0 | zhangsan | 张三 |
4 | 2023-01-01 00:00:00 | 2023-01-04 00:00:00 | 0 | lisi | 李四 |
5 | 2023-01-01 00:00:00 | 2023-01-05 00:00:00 | 1 | wangwu | 王五 |
支持的模式
- client_credentials
请求方法
GET
请求地址
https://api.ecnu.edu.cn//api/v1/sync/fakewithts
通用请求参数
参数名 | 是否必填 | 备注 |
---|---|---|
ts | 是 | 增量时间戳,单位是秒,返回该时间戳之后产生变更的数据。输入 ts=0 即返回全量数据 |
full | 否 | 默认仅返回有效数据(有效的含义根据实际业务决定),如果 full 参数有值(无论是什么),都会返回全部数据,包括已经被删除的数据 |
pageSize | 是 | 单页大小,最大10000 |
pageNum | 是 | 第几页,从第一页开始 |
全量同步有效用户示例
https://api.ecnu.edu.cn//api/v1/sync/fakewithts?pageSize=5&pageNum=1&ts=0
应该返回除了王五以外的4条记录。
json
{
"errCode": 0,
"errMsg": "success",
"requestId": "38756c45-3b93-41e1-b21c-09dfb5531334",
"data": {
"pageSize": 5,
"pageNum": 1,
"totalNum": 4,
"rows": [{
"id": 1,
"created_at": "2023-01-01 00:00:00",
"updated_at": "2023-01-01 00:00:00",
"deleted_mark": 0,
"userId": "dingyi",
"name": "丁一"
}, {
"id": 2,
"created_at": "2023-01-01 00:00:00",
"updated_at": "2023-01-02 00:00:00",
"deleted_mark": 0,
"userId": "qianer",
"name": "钱二"
}, {
"id": 3,
"created_at": "2023-01-01 00:00:00",
"updated_at": "2023-01-03 00:00:00",
"deleted_mark": 0,
"userId": "zhangsan",
"name": "张三"
}, {
"id": 4,
"created_at": "2023-01-01 00:00:00",
"updated_at": "2023-01-04 00:00:00",
"deleted_mark": 0,
"userId": "lisi",
"name": "李四"
}]
}
}
增量同步示例(含上游删除变化)
上一次获取数据的最大时间戳是 1672761600
,即 2023-01-04 00:00:00
用它作为 ts
参数,并加上 full
参数,则可以获取到该时间戳之后的所有数据,包括已经被删除的数据。
json
{
"errCode": 0,
"errMsg": "success",
"requestId": "944f768c-d4c3-4b39-9ba8-b8d11f2216d3",
"data": {
"pageSize": 5,
"pageNum": 1,
"totalNum": 1,
"rows": [{
"id": 5,
"created_at": "2023-01-01 00:00:00",
"updated_at": "2023-01-05 00:00:00",
"deleted_mark": 1,
"userId": "wangwu",
"name": "王五"
}]
}
}
性能测试
支持的模式
- client_credentials
请求方法
GET
请求地址
https://api.ecnu.edu.cn//api/v1/sync/fake
通用请求参数
参数名 | 是否必填 | 备注 |
---|---|---|
totalNum | 是 | 总共返回的数据量,最大1000000 |
pageSize | 是 | 单页大小,最大10000 |
pageNum | 是 | 第几页,从第一页开始 |
请求测试示例
https://api.ecnu.edu.cn//api/v1/sync/fake?totalNum=100&pageSize=1&pageNum=1
json
{
"errCode": 0,
"errMsg": "success",
"requestId": "ba0b3601-d5c4-472e-9334-ac4d92b6289c",
"data": {
"pageSize": 1,
"pageNum": 1,
"totalNum": 100,
"rows": [{
"id": 1,
"colString1": "eIOGtdyhSs",
"colString2": "m2PP5S3KCZxQ4l1dtfl9",
"colString3": "qgEj2E94IRBD3gX56mOUzPrGRh3E9L",
"colString4": "WZVlwipDcLrg2ngqg4pqBkFRxfSFFdxObk4HMwAg",
"colInt1": 7853639011485401781,
"colInt2": 3273552291852778590,
"colInt3": 188609050050130584,
"colInt4": 39673590492075355,
"colFloat1": 0.9221609135209919,
"colFloat2": 0.3852665928873978,
"colFloat3": 0.09738243456306053,
"colFloat4": 0.30461538211692923,
"colSqlTime1": "2023-11-17 11:06:48",
"colSqlTime2": "2023-11-17 11:06:48",
"colSqlTime3": "2023-11-17 11:06:48",
"colSqlTime4": "2023-11-17 11:06:48"
}]
}
}