调用接口出现invalid media type hint?
发布于 5 年前 作者 caolei 7956 次浏览 来自 官方Issues

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);

```

求解答

回到顶部