收藏
回答

调用接口出现invalid media type hint?

java代码调用

https://api.weixin.qq.com/wxa/media_check_async

接口出现{"errcode":40004,"errmsg":"invalid media type hint: [sKhR.a07191531]"}问题

```

HttpPost request1 = new HttpPost("https://api.weixin.qq.com/wxa/media_check_async?media_type=2&access_token=" + accessToken);

request1.addHeader("Content-Type", "application/json;charset=UTF-8");
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put("media_url", url);
request1.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.create("application/json", "utf-8")));

// 处理返回结果
CloseableHttpResponse response = httpclient.execute(request1);
HttpEntity httpEntity = response.getEntity();
String result = EntityUtils.toString(httpEntity, "UTF-8");// 转成string
System.out.println(result);
JSONObject jso = JSONObject.parseObject(result);

```

求解答


回答关注问题邀请回答
收藏

1 个回答

  • akka
    akka
    2020-10-27

    也是服了,这偶没人解答。

    post请求的 content-type 还不能设置为 application/json?
    
    2020-10-27
    有用
    回复
登录 后发表内容
问题标签