微信高级群发之一上传图文消息素材

  /**
* uploadNews(List messageInfos)上传图文消息素材,最多上传10个图文

* accessToken:(ACCESS_TOKEN长期有效).  

*  

* @author HanKeQi  

* @param  @return          设定文件

* @throws String   DOM对象  

* @since  JDK 1.7

*/

public static String uploadNews(List messageInfos){

String accessToken=getAccessToken();

String url="https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token="+accessToken;

String jsonStr=JSONArray.fromObject(messageInfos).toString();

String jsonMessage="{\"articles\":"+jsonStr+"}";

JSONObject jsonObject = httpRequest(url, "POST", jsonMessage);

if (!jsonObject.containsKey("errcode")) {

return jsonObject.toString();

}

log.error("上传图文消息素材失败 errcode:{" + jsonObject.getInt("errcode")+"} errmsg:{"+jsonObject.getString("errmsg")+"} ");

return null;

}


你可能感兴趣的:(微信)