(#803)您请求的某些别名不存在:{education-experience-id} Android

时间:2016-05-27 09:07:58

标签: android facebook facebook-graph-api social social-media

我正试图从Facebook获取用户的教育细节和工作描述。我成功登录并获得了Access令牌。但我无法获得我想要的细节

我正在使用的代码: -

    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}

2 个答案:

答案 0 :(得分:4)

最后,我通过以下代码获得了完整的工作和教育细节:

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

可以帮助别人! 快乐的编码:)

答案 1 :(得分:3)

请确保您获得该许可的授权:user_education_history

API调用以获取教育ID列表:https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Deducation

在您的代码中,您需要将以下字符串替换为生成的教育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();