通过微信小程序平台提供的接口 访问日活数据 date format错误?

https://api.weixin.qq.com/dat...
POST 内容示例:

{
"begin_date" : "20170313",
"end_date" : "20170313"
}

            CloseableHttpClient httpClient = createSSLClientDefault();
            HttpPost httpPost = new HttpPost();
            httpPost.setURI(new URI(url));
            httpPost.setEntity(new UrlEncodedFormEntity(nvps));

            CloseableHttpResponse response = httpClient.execute(httpPost);
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                String result = EntityUtils.toString(entity, "UTF-8");
                System.out.println("Response content: " + result);
                return result;
            }

clipboard.png

clipboard.png

Response content: {"errcode":61500,"errmsg":"date format error hint: [Dy5YZa0787e541]"}

阅读 4.6k
2 个回答

httpPost.setEntity(new StringEntity(params.toString(), "UTF-8"));

你看,

{
"begin_date" : "20170313",
"end_date" : "20170313"
}

这是一个json的传参格式,而你用的却是urlencoded方式

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题