我正在尝试将我的应用更新为通过脸谱图API v2.0获取共同朋友的新方法。
在他们的网站上:https://developers.facebook.com/docs/graph-api/reference/v2.0/user.context/mutual_friends
他们建议使用此代码:
Bundle params = new Bundle();
params.putString("fields", "context.fields(mutual_friends)");
/* make the API call */
new Request(
session,
"/{user-id}",
params,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
所以我编辑了这段代码,就像这样放入了用户名......
Bundle params = new Bundle();
params.putString("fields", "context.fields(mutual_friends)");
// make the API call
new Request(Session.getActiveSession(), "/{" + userProfile.getString("facebookId") + "}", params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
System.out.println(response.toString());
}
}).executeAsync();
当我运行代码时,我收到此错误:
{Response:responseCode:404,graphObject:null,error:{HttpStatus:404,errorCode:803,errorType:OAuthException,errorMessage:(#803)您请求的某些别名不存在:{10102533400666784}}, isFromCache:假}
这个别名确实存在。我的要求有什么问题?
答案 0 :(得分:2)
错误响应解释了
{Response:responseCode:404,graphObject:null,error:{HttpStatus:404,errorCode:803,errorType:OAuthException,errorMessage:(#803)您请求的某些别名不存在:{10102533400666784}}, isFromCache:假}
此别名{10102533400666784}
不存在会删除{}