{"errcode":40103,"errmsg":"invalid industry index"}

编程入门 行业动态 更新时间:2024-10-22 09:39:51

设置所属行业

设置行业可在微信公众平台后台完成,每月可修改行业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());

更多推荐

{"errcode":40103,"errmsg":"invalid industry index"

本文发布于:2023-06-13 18:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1391990.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:errcode   quot   errmsg   index   industry

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!