调用内容安全接口一直调用不通,java各种方式都试了一直返回47001?
发布于 7 年前 作者 haofang 9792 次浏览 来自 官方Issues
try {
HttpClient httpclient = new DefaultHttpClient();
   HttpPost httpPost = new HttpPost(sendUrl);
   File uploadFile = new File("/Users/ethan/Downloads/test.jpg");

   FileBody uploadFilePart = new FileBody(uploadFile);
   MultipartEntity reqEntity = new MultipartEntity();
   reqEntity.addPart("media", uploadFilePart);
   httpPost.setEntity(reqEntity);
   HttpResponse response = httpclient.execute(httpPost);

   HttpEntity entity = response.getEntity();
   if(entity!=null){
String result = EntityUtils.toString(entity,"UTF-8");
       System.out.println(result);

   }
}catch (Exception e){
e.printStackTrace();
}

一直返回

{“errcode”:47001,“errmsg”:“data format error hint: [SAESjA04011548]”}

回到顶部