微信公众平台官网:https://mp.weixin.qq.com
数据统计模块儿,图文分析数据接口(以getarticletotal接口为例)
https://api.weixin.qq.com/datacube/getarticletotal?access_token=ACCESS_TOKEN
接口介绍:
该接口只有三个参数,access_token 是请求接口的凭证,是必须要的,begin_date和end_date,最大跨度时间为1天,也就是两个参数必须是同一天,end_date允许设置的最大值为昨日,但最多统计发表日后7天数据。
了解了规则,接下来撸代码:
实例化微信工具类(自写)
WeixinUtil wu = new WeixinUtil(gi.getOriginalId() + "", gi.getAppId(), gi.getSecret(), "", "");
然后调用接口
Map<String, Object> map = wu.getArticleTotal(day, day);
getArticleTotal接口内
// 图文素材接口
public Map<String, Object> getArticleTotal(String begin_date, String end_date) throws Exception {
String url = "https://api.weixin.qq.com/datacube/getarticletotal?access_token=" + getAccessToken();
String json = HttpRequestHelper.paramsPostJson(url,