打印请求参数:
{"expire_time":30,"jump_wxa":{"pages":"pages/flow/buyflow","query":""}}
返回:
{"errcode":47001,"errmsg":"data format error rid: 6267521b-22a4b4f6-283ac782"}
代码:
String accessToken = "56_M6f0MCRaRMd1wMTVXNkwqkBG4lEiDgpVFwt4H8gDBgUXZWcEy0E33GwrBcx6J-IlphRasxh2zHz0nez7-kex-kOXnrJ1Cd52kK9gCmkuGYO6cSJJM8n2o0KoCBWMWk6JreGmFqX_aqmnPF46JZHiABAEUC";
String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token=56_M6f0MCRaRMd1wMTVXNkwqkBG4lEiDgpVFwt4H8gDBgUXZWcEy0E33GwrBcx6J-IlphRasxh2zHz0nez7-kex-kOXnrJ1Cd52kK9gCmkuGYO6cSJJM8n2o0KoCBWMWk6JreGmFqX_aqmnPF46JZHiABAEUC";
JSONObject json = new JSONObject();
// json.put("access_token", accessToken);
json.put("expire_time", 30);
// json.put("expire_type", 1);
JSONObject jump_wxa = new JSONObject();
// jump_wxa.put("env_version", "release");
jump_wxa.put("pages", "pages/flow/buyflow");
jump_wxa.put("query", "");
json.put("jump_wxa", jump_wxa);
log.info("入参" + json.toString());
String body = HttpRequest.post(url)
.header("Content-Type", "application/json")
.body(json.toString()).execute().body();
知道是格式解析错误,但是不知道错再哪了 , 请求工具用的是hutool
刚用POSTMAN试了一下 一样的错误
是 path 不是 pages 而且路径必须是线上版本存在的页面路径
发现了这个问题了,还有一个就是请求体里不能设置accessToken . 3Q