NutzCN Logo
问答 微信视频上传add_video,里面的地址也是错的,能不能改下?
发布于 2772天前 作者 qq_d6c9c504 1566 次浏览 复制 上一个帖子 下一个帖子
标签:
 public WxResp add_video(File f, String title, String introduction) {
        if(f == null) {
            throw new NullPointerException("meida file is NULL");
        } else {
            String url = String.format("https://api.weixin.qq.com/cgi-bin/media/add_material?access_token=%s", new Object[]{this.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());
            } else {
                return (WxResp)Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
            }
        }
    }
添加回复
请先登陆
回到顶部