@Override
public WxResp add_video(File f, String title, String introduction) {
if (f == null)
throw new NullPointerException("meida file is NULL");
String url = String.format("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=%s", getAccessToken());
Request req = Request.create(url, METHOD.POST);
req.getParams().put("media", f);
req.getParams().put("description",
Json.toJson(new NutMap().setv("title", title).setv("introduction", introduction),
JsonFormat.compact().setQuoteName(true)));
Response resp = new FilePostSender(req).send();
if (!resp.isOK())
throw new IllegalStateException("add_material, resp code=" + resp.getStatus());
return Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
}
调用的是这个代码上传视频,上传到微信的视频永久不审核。