首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从linkedin api获取技能?

从linkedin api获取技能?
EN

Stack Overflow用户
提问于 2014-12-09 04:39:17
回答 2查看 7.6K关注 0票数 0

可能是一个简单的问题,但我还找不到任何关于这方面的教程。我在java中使用linkedin api,并在android上实现它。我能够获得教育,职位和其他信息,但我不确定如何检索技能。这就是我所拥有的:

代码语言:javascript
复制
private static final String PROFILE_URL = "https://api.linkedin.com/v1/people/~:(id,phone-numbers,headline,educations,positions, skills, recommendations-received)?oauth2_access_token=";

public CareerPluginImpl(final ProviderSupport providerSupport) {
    this.providerSupport = providerSupport;
}

public Career getCareerDetails() throws Exception {
    LOG.info("Fetching career details from " + PROFILE_URL);

    Response serviceResponse = null;
    try {
        serviceResponse = providerSupport.api(PROFILE_URL
                + providerSupport.getAccessGrant().getKey());
    } catch (Exception ie) {
        throw new SocialAuthException(
                "Failed to retrieve the career details from " + PROFILE_URL, ie);
    }
    Element root;
    try {
        root = XMLParseUtil.loadXmlResource(serviceResponse.getInputStream());
    } catch (Exception e) {
        throw new ServerDataException(
                "Failed to parse the career details from response."
                        + PROFILE_URL, e);
    }
    Career career = null;
    if (root != null) {
        career = new Career();
        Education[] educationsArr = null;
        Position[] positionsArr = null;
        Recommendation[] recommendationsArr = null;
        Skill[] skillsArr = null;
        String headline = XMLParseUtil.getElementData(root, "headline");
        career.setHeadline(headline);
        String id = XMLParseUtil.getElementData(root, "id");
        career.setId(id);



// get Skills
        NodeList skills = root
                .getElementsByTagName("skills");
        if (skills != null && skills.getLength() > 0) {
            LOG.debug("skills count "
                    + skills.getLength());

            skillsArr = new Skill[skills.getLength()];
            for (int i = 0; i < skills.getLength(); i++) {
                Skill skillObj = new Skill();
                Element skillEl = (Element) skills.item(i);
                String sid = XMLParseUtil.getElementData(skillEl, "id");
                if (sid != null) {
                    skillObj.setSkillId(sid);
                }
                String text = XMLParseUtil.getElementData(skillEl, "skill");
                if (text != null) {
                    skillObj.setSkillText(text);
                }


                skillsArr[i] = skillObj;
            }
        }

    if (skillsArr != null) {
            career.setSkills(skillsArr);
        }
    }
    return career;
}

与career一起返回的技能列表似乎总是返回空。我可能不确定我正在尝试获取的对象,并且文档也没有真正的帮助。有什么想法吗?

EN

回答 2

Stack Overflow用户

发布于 2014-12-09 04:42:10

我建议阅读配置文件文档,以了解配置文件API是如何工作的,以及提供了哪些字段。技能是需要r_fullprofile成员权限的"Full Profile“字段集的一部分:

https://developer.linkedin.com/documents/profile-fields#fullprofile

例如,检索经过身份验证的用户的技能集的调用如下所示:

http://api.linkedin.com/v1/people/~:(skills)

如果我是对的,这应该返回一个包含数据的xml格式。您必须对其进行解析并使其在应用程序中可见

票数 2
EN

Stack Overflow用户

发布于 2015-04-04 22:41:12

您可以为经过身份验证的配置文件(您自己)获取此信息,但不能为您的网络获取此信息。

来自Linkedin的Connections API参考:

对于一级连接,您只能检索具有r_basicprofile成员权限的配置文件字段

不幸的是,Linkedin API并没有那么开放。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27366488

复制
相关文章

相似问题

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