首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >(#803)您请求的某些别名不存在:{education-experience-id} Android

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

Stack Overflow用户
提问于 2016-05-27 17:07:58
回答 2查看 17.6K关注 0票数 5

我试图从facebook获得教育细节和用户的工作描述。我成功登录并获得访问令牌。但是我不能得到我想要的细节

我正在使用的代码:

代码语言:javascript
复制
    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}

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-05-27 19:30:17

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

代码语言:javascript
复制
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();

也许能帮到什么人!快乐编码:)

票数 4
EN

Stack Overflow用户

发布于 2016-05-27 17:48:20

确保您使用该权限进行授权:user_education_history

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

在您的代码中,需要将以下字符串替换为生成的教育ID之一:{education-experience-id}

例如:

代码语言:javascript
复制
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/12345",
        null,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
                Log.d("fb response",response.toString());
            }
        }
).executeAsync();
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37479365

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档