QQAP_交互查询-API模式说明
1.导入最新的模版或者手动新建指定的字段
PS: 新增 字段信息如下
主表
APIURL 文本字段(API网站)
JXDX 文本字段(JSON 返回解析对象)
TJMS 整数字段 (访问模式 0:GET , 1: POST)
明细
AI 字段下拉选择新增 GET 选项
DXMC 文本字段 (JSON解析对象名称)
POST 文本字段 (POST)
2.点击交互查询下方的按钮恢复使用最新的默认语句(也可手工添加字段)
把新增的字段引入SQL语句
3.打开API模式
4.新建API交互查询表单
例1:对接快递100进行查询快递
PS:
APIURL http://www.kuaidi100.com/query?type={{.p1}}&postid={{.p2}}
其中的{{.p1}},{{.p2}}来源于下级交互输入内容
demo
http://www.kuaidi100.com/query?type=yunda&postid=3101775486667
解析方法:
API结果如下:
- {
- “message”: “ok”,
- “nu”: “3101775486667”,
- “ischeck”: “0”,
- “condition”: “00”,
- “com”: “yunda”,
- “status”: “200”,
- “state”: “5”,
- “data”: [{
- “time”: “2018-05-24 08:40:05”,
- “ftime”: “2018-05-24 08:40:05”,
- “context”: “[河北秦皇岛公司]进行快件扫描,发往:河北秦皇岛公司经济技术开发区分部”,
- “location”: null
- }, {
- “time”: “2018-05-23 16:44:37”,
- “ftime”: “2018-05-23 16:44:37”,
- “context”: “[河北秦皇岛公司]到达目的地网点,快件很快进行派送”,
- “location”: null
- }, {
- “time”: “2018-05-23 16:44:25”,
- “ftime”: “2018-05-23 16:44:25”,
- “context”: “[河北秦皇岛公司]到达目的地网点,快件很快进行派送”,
- “location”: null
- }, {
- “time”: “2018-05-23 07:43:42”,
- “ftime”: “2018-05-23 07:43:42”,
- “context”: “[北京分拨中心]从站点发出,本次转运目的地:河北秦皇岛公司”,
- “location”: null
- }, {
- “time”: “2018-05-23 07:05:27”,
- “ftime”: “2018-05-23 07:05:27”,
- “context”: “[北京分拨中心]在分拨中心进行卸车扫描”,
- “location”: null
- }, {
- “time”: “2018-05-22 01:53:04”,
- “ftime”: “2018-05-22 01:53:04”,
- “context”: “[重庆分拨中心]进行装车扫描,发往:北京分拨中心”,
- “location”: null
- }, {
- “time”: “2018-05-22 01:48:36”,
- “ftime”: “2018-05-22 01:48:36”,
- “context”: “[重庆分拨中心]在分拨中心进行称重扫描”,
- “location”: null
- }, {
- “time”: “2018-05-22 00:06:07”,
- “ftime”: “2018-05-22 00:06:07”,
- “context”: “[重庆渝中区杨家坪公司]进行揽件扫描”,
- “location”: null
- }, {
- “time”: “2018-05-21 21:37:17”,
- “ftime”: “2018-05-21 21:37:17”,
- “context”: “[重庆渝中区杨家坪公司]进行下级地点扫描,发往:北京分拨中心”,
- “location”: null
- }, {
- “time”: “2018-05-21 20:16:09”,
- “ftime”: “2018-05-21 20:16:09”,
- “context”: “[重庆渝中区杨家坪公司]进行揽件扫描”,
- “location”: null
- }]
- }
复制代码
例如:这里需要取出
nu(运单号码)
status(状态)
和data数组明细内的 context和time
JSON解析对象名称:”nu+运单号码|status+状态|data[time+时间,context+详情]“
PS: 其中| 为多个对象分隔符,[]为数组对象(数组内对象使用半角逗号分割),+后面为返回数据时的别名
返回结果如下:
例2:对接企业微信发送消息为企业微信用户
PS:发送企业微信首先需要获取AccessToken
这里下级参数 API URL 内填写https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect
- 参数说明
参数 必须 说明
corpid 是 企业Id
corpsecret 是 管理组的凭证密钥AI 字段选择GET
根据微信开发文档得知返回数据格式 :
{ “access_token”: “accesstoken000001”, “expires_in”: 7200}
这里需要取出 access_token 所以 返回对象字段 填写access_token
发送消息API URL 地址为:
https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={{.p1_ai0}}
{{.p1_ai0}} 为下级的access_token返回结果
POST 数据格式为:
{“touser”: “{{.p1}}”,”msgtype”: “text”,”agentid”: 7,”text”: {“content”: “{{.p2}}”},”safe”:0}
其中的{{.p1}},{{.p2}}来源于下级交互输入内容
3.4.8 更新1.APIURL 支持变量({{来源QQ}}, {{信息内容}}, {{来源群}},{{讨论组}}, {{模版名称}}, {{年}}, {{月}}, {{日}},{{时}} ,{{分}}, {{秒}}, {{随机}})
2.POST 支持系统变量({{姓名}},{{账号}},{{部门}},{{手机号}},{{邮箱}},{{性别}},{{职位}},{{来源QQ}}, {{信息内容}}, {{来源群}},{{讨论组}}, {{模版名称}}, {{年}}, {{月}}, {{日}},{{时}} ,{{分}}, {{秒}}, {{随机}})
PS:解析说明JOSN
- {
- “test1”: “Hello World!”,
- “test2”: {
- “child1”: “值1”,
- “child2”: “值2”
- },
- “array”: [{
- “app1”: “值a”,
- “app2”: “值b”
- }, {
- “app1”: “值c”,
- “app2”: “值d”
- }],
- “data”: {
- “city”: {
- “cityId”: “值3”,
- “counname”: “值4”,
- “pname”: “值5”
- },
- “condition”: {
- “cond”: “值6”,
- “windDir”: “值7”,
- “windLevel”: “值8”
- }
- },
- “date”: {
- “shidu”: “22%”,
- “wendu”: “值9”,
- “ganmao”: “值10”,
- “forecast”: [{
- “date”: “22”,
- “ymd”: “2018-09-22”,
- “week”: “星期六”
- },
- {
- “date”: “23”,
- “ymd”: “2018-09-23”,
- “week”: “星期日”
- }
- ]
- }
- }
解析说明:
1.test1 解析结果 “Hello World!”
2.test1+名称:解析结果 “名称:Hello World!”
3.test2{child1} 解析结果 “值1”
4.test2{child2+名称:} 解析结果 “名称:值2”
5.data{city{cityId}}解析结果 “值3”
6.data{city{counname+结果:}}解析结果 “结果:值4”
7.array[app1+名称:,app2+地址:]
解析结果“名称:值a
地址:值b
名称:值c
地址:值d”
8.array[app1+名称:,app2+地址:]1
解析结果“名称:值a
地址:值b”
9.date{forecast[ymd+日期:,week]}
解析结果“日期:2018-09-22
星期六
日期:2018-09-23
星期日”
10.9.date{forecast[ymd+日期:,week]1}
解析结果“日期:2018-09-22
星期六”
- Pingback: QQAP 交互查询获取阿里云墨迹天气API - QQAP_ERP