(#803)您请求的某些别名不存在:{education experience id}Android
我试图从facebook上获取用户的教育细节和工作描述。我成功登录并获得访问令牌。但我无法得到我想要的细节 我正在使用的代码:-(#803)您请求的某些别名不存在:{education experience id}Android,android,facebook,facebook-graph-api,social,social-media,Android,Facebook,Facebook Graph Api,Social,Social Media,我试图从facebook上获取用户的教育细节和工作描述。我成功登录并获得访问令牌。但我无法得到我想要的细节 我正在使用的代码:- public void getUserExpandEducation() { new GraphRequest( AccessToken.getCurrentAccessToken(), "/{education-experience-id}", //"/{user_education_history}",/
public void getUserExpandEducation() {
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{education-experience-id}", //"/{user_education_history}",//
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.d("fb response",response.toString());
}
}
).executeAsync();
}
有人能回答吗
我收到错误(#803)您请求的某些别名不存在:{education experience id}请确保您获得该权限的授权:
用户教育历史
获取教育ID列表的API调用:
在代码中,您需要将以下字符串替换为生成的教育id之一:{education experience id}
例如:
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/12345",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.d("fb response",response.toString());
}
}
).executeAsync();
最后,我通过以下代码获得了完整的工作和教育细节:
GraphRequest request = GraphRequest.newMeRequest(
accessToken,
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject object,
GraphResponse response) {
FirstNameSocial = object.optString("first_name");
LastNameSocial = object.optString("last_name");
GenderSocial = object.optString("gender");
EmailSocial = object.optString("email", "");
id = object.optString("id");
if (!EmailSocial.equals("")) {
login_type = Config.Login_Type_facebook;
callAPI(EmailSocial, id, "");
} else {
Toast.makeText(getApplicationContext(), "Permision Denied", Toast.LENGTH_LONG)
.show();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,birthday,gender,first_name,last_name,picture,education,work");
request.setParameters(parameters);
request.executeAsync();
可能会帮助别人!
快乐编码:)用实际id替换字符串怎么样?这是我们需要传递的权限URL。如何获得用户教育的实际id/{education experience id}——这只是文档中的一个占位符。当然你需要更换它。不确定你的权限url是什么意思,登录是一个完全不同的主题。您需要在使用该端点之前进行授权。问题是如何获得id?+1是一个好方法,正如我提到的,我的目标是获得用户的教育细节和工作经验。你能给我更多的指导或发送代码吗。描述:-我的回答应该包括你需要知道的一切,老实说,我不确定你还期望什么?只需打开我答案中的链接,并确保您获得了正确的授权。链接中的api调用为您提供了教育列表,其中没有多少魔力。这是对graph api的一个简单的get调用。谢谢,你的回答帮了我太多的忙:)你能说一下你从哪里找到这些使用graph的方法吗?@akanksha我们如何在一些say列表视图中打印这个结果?在onCompleted方法中,你会得到响应。在此之后,您可以随时显示结果。若您希望listview如此—在列表中添加数据并用适配器绑定该列表,然后用listview绑定适配器。