admin管理员组

文章数量:1536087

设置所属行业

设置行业可在微信公众平台后台完成,每月可修改行业1次,帐号仅可使用所属行业中相关的模板,为方便第三方开发者,提供通过接口调用的方式来修改账号所属行业,具体如下:

接口调用请求说明

http请求方式: POST
https://api.weixin.qq/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN

POST数据说明

POST数据示例如下:

{
    "industry_id1":"1",
    "industry_id2":"4"
}

 post请求:{"errcode":40103,"errmsg":"invalid industry index"}

解决方案:

postJson请求,将参数拼成json字符串请求即可

JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("industry_id1","1");
jsonObject1.put("industry_id2","4");
private static HttpClient httpClient = null;

public static HttpClient getHttpClient() {
    if (httpClient == null) {
        httpClient = HttpClientBuilder.create().build();
    }
    return httpClient;

}
public static JSONObject executeByPOST(String url,String params) {
    HttpClient httpclient = getHttpClient();
    HttpPost post = new HttpPost(url);
    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    StringEntity postEntity = new StringEntity(params, "UTF-8");
    postEntity.setContentType("application/json;utf-8");
    try {
        if (params != null) {
            post.setEntity(postEntity);
        }
        String responseJson = httpclient.execute(post, responseHandler);
        return JSONObject.parseObject(responseJson);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return new JSONObject();
}
JSONObject = POST(url,jsonObject1.toJSONString());

本文标签: ErrcodequoterrmsgINDEXindustry