【问题标题】:get skills from linkedin api?从linkedin api获得技能?
【发布时间】:2015-04-04 22:41:11
【问题描述】:

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

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;
}

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

【问题讨论】:

  • 你检查返回的xml的内容了吗?
  • 我不知道该怎么做。我正在使用日食

标签: java android linkedin


【解决方案1】:

我建议阅读 Profile 文档以了解 Profile API 的工作原理以及提供的字段。技能是需要 r_fullprofile 成员权限的“完整档案”字段集的一部分:

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

例如,检索已验证用户的技能集的调用如下所示:

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

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

【讨论】:

    【解决方案2】:

    您可以为经过身份验证的个人资料(您自己)获取此信息,但不能为您的网络获取此信息。

    来自 Linkedin 的 Connections API 参考:

    对于 1 度人脉,您只能检索个人资料字段 可通过 r_basicprofile 成员权限获得

    很遗憾,Linkedin API 并没有那么开放。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-05-13
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多