// 调用jserr_list接口时,data为空,但是我在管理台是能看到错误列表的,这是为什么?
curl --location --request POST 'https://api.weixin.qq.com/wxaapi/log/jserr_list?access_token=access_token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: wxuin=36093342443566' \
--data-urlencode 'appVersion=0' \
--data-urlencode 'errType=0' \
--data-urlencode 'startTime=2021-10-28' \
--data-urlencode 'endTime=2021-11-04' \
--data-urlencode 'keyword=' \
--data-urlencode 'openid=' \
--data-urlencode 'orderby=pv' \
--data-urlencode 'desc=2' \
--data-urlencode 'offset=0' \
--data-urlencode 'limit=1'
// 返回
{
success: true,
openid: '',
data: [],
totalCount: 0,
errcode: 0,
__rpcCount: 2
}
// 设置Content-Type: application/json
curl --location --request POST 'https://api.weixin.qq.com/wxaapi/log/jserr_list?access_token=access_token' \
--header 'Content-Type: application/json' \
--data-urlencode 'appVersion=0' \
--data-urlencode 'errType=0' \
--data-urlencode 'startTime=2021-10-28' \
--data-urlencode 'endTime=2021-11-04' \
--data-urlencode 'keyword=' \
--data-urlencode 'openid=' \
--data-urlencode 'orderby=pv' \
--data-urlencode 'desc=2' \
--data-urlencode 'offset=0' \
--data-urlencode 'limit=1'
// 直接报错
{"errcode":-1,"errmsg":"system error rid: 6184d6fd-4e59e751-59dd38bb"}
问题终结
startTime和endTime的格式必须是yyyy-MM-dd HH:mm:ss,文档上写的是yyyy-MM-dd,我改了下时间格式就成功了。
这样?
curl --location --request POST 'https://api.weixin.qq.com/wxaapi/log/jserr_list?access_token=access_token' \ --header 'Content-Type: application/json' \ --data-raw '{ "startTime": "2021-01-25", "endTime": "2021-01-26", "errType": "0", "appVersion": "0", "openid": "", "keyword": "", "orderby": "uv", "desc": "2", "offset": 0, "limit": 1 }'
文档用的是json?你用的是--data-urlencode?我没用过这个接口,不过你可以试试用postman body raw里面的json格式去测
{"success":true,"openid":"","data":[],"totalCount":0,"errcode":0,"__rpcCount":2}
用json, 文档都不看的吗
{"errcode":-1,"errmsg":"system error rid: 6184d7c7-37d93eee-134107fe"}
curl 'https://api.weixin.qq.com/wxaapi/log/jserr_list?access_token=access_token' -X POST -d '{"appVersion":"0","errType":"0","startTime":"2021-11-01","endTime":"2021-11-05","keyword":"","openid":"","orderby":"pv","desc":"1","offset":0,"limit":1}' --header "Content-Type: application/json"