调用方式
管理平台注册的所有API均使用HTTPS GET方式调用,在调用时,需要在Header中传递调用凭证{appKey},其它所有参数均放在请求头url中.
关键字 | 描述 |
---|---|
API网关 | {服务地址} |
传输方式 | 为保证接口安全性,建议采用HTTPS传输 |
请求方式 | 采用GET方法发送请求 |
数据格式 | JSON格式(application/json) |
调用凭证 | 在Header中以appKey: {appKey} 传递 |
必填请求参数
目前有 1 个必填请求参数,即在请求Header中传递接口签名
示例
curl -H "appKey: {appKey}" --request GET "{服务地址}/{apiPath}"
可选请求参数
1.分页
在请求url中传递pageNum(默认值1),pageSize(默认值10),目的是在自定义数据发布中进行分页查询
示例
curl -H "appKey: {appKey}" --request GET "{服务地址}/{apiPath}?pageNum=1&pageSize=10"
2.字段查询
在请求url中用以下格式传递,目的是在自定义数据发布中进行条件查询
格式 | 描述 | 逻辑 |
---|---|---|
where_{field}=xxx | 精确查询 | ... where field = 'xxx' |
where_like#_{field}=xxx | 右端模糊查询 | ... where field like 'xxx%' |
where_#like_{field}=xxx | 左端模糊查询 | ... where field like '%xxx' |
where_#like#_{field}=xxx | 两端模糊查询 | ... where field like '%xxx%' |
custom=true&condition=to_base64(xxx) | 自定义查询条件 | ... where from_base64(xxx) |
解析优先级: 精确查询>模糊查询>自定义查询.{field}表示表字段,to_base64(xxx)表示将xxx进行base64编码,from_base64(xxx)表示将xxx进行base64解码
示例
curl -H "appKey: {appKey}" --request GET "{服务地址}/{apiPath}?{field}=xxx"
调用返回
1.API调用成功时返回格式为
{ "code": 0, "msg": null, "data": "xxx", "failed": false, "success": true }
其中code为返回码,成功时固定为0,data为API调用返回的实际内容
2.API调用失败时,返回格式为
{ "code": xx, "msg": "xxx", "data": "xxx", "failed": true, "success": false }
其中,code为返回码,msg为错误信息。