Java 使用graph api标记照片中的朋友;500内部服务器错误“;
我正在开发一个应用程序,它应该能够将照片上传到Facebook页面业务,并在照片中标记用户 我的问题是照片上传得很好,但当我尝试标记照片时,它在Facebook页面上不可见,在照片的信息中显示标记存在,但带有一条消息“requested tag” 这是我的代码摘要:Java 使用graph api标记照片中的朋友;500内部服务器错误“;,java,facebook-graph-api,upload,tags,photo,Java,Facebook Graph Api,Upload,Tags,Photo,我正在开发一个应用程序,它应该能够将照片上传到Facebook页面业务,并在照片中标记用户 我的问题是照片上传得很好,但当我尝试标记照片时,它在Facebook页面上不可见,在照片的信息中显示标记存在,但带有一条消息“requested tag” 这是我的代码摘要: FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class, BinaryAttachment
FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
BinaryAttachment.with("photo.jpg", readImagen(this.namePhoto)),
Parameter.with("message",this.message));
String photoId= publishPhotoResponse.getId();
try {
String relativePath = photoId + "/tags/" + userId;
StringBuilder sb = new StringBuilder("access_token=");
sb.append(URLEncoder.encode(token_user, "UTF-8"));
sb.append("&x=");
sb.append(URLEncoder.encode("50", "UTF-8"));
sb.append("&y=");
sb.append(URLEncoder.encode("50", "UTF-8"));
URL url = new URL("https://graph.facebook.com/"+relativePath);
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestMethod("POST");
httpCon.setRequestProperty("Content-Type", "multipart/form-data");
httpCon.setRequestProperty("Content-Length", "" + sb.toString().length());
OutputStreamWriter out = new OutputStreamWriter( httpCon.getOutputStream());
out.write(sb.toString());
out.flush();
System.out.println(httpCon.getResponseCode());
System.out.println(httpCon.getResponseMessage());
System.out.println(sb.toString());
System.out.println(out.getEncoding());
System.out.println(out.toString());
System.out.println("url : "+url);
} catch (IOException ex) {
System.out.println(ex);
}
在控制台中显示以下信息:
500
Internal Server Error
access_token=XXXXXXXXXX....XXXX..X&x=50&y=50
UTF8
java.io.OutputStreamWriter@1eb13dc
url : https://graph.facebook.com/XXXXXXXXXXXXX/tags/XXXXXXXXXXXXX
我不知道是什么问题,根据500的错误似乎不是我的错误,但可能我做得不对。有人能帮我吗?关于这个问题有什么消息吗?我也面临同样的问题。。。