2014-12-08 6 views
0

아마도 간단한 질문이지만 이것에 대한 자습서를 찾을 수 없었습니다. 자바에서 linkedin api를 사용하고 있으며 android에서 구현하고 있습니다. 교육, 직위 및 기타 정보를 얻을 수는 있지만 기술을 검색하는 방법을 모르겠습니다. 여기에 내가 가지고있는 것이있다 :linkedin API에서 기술을 습득 하시겠습니까?

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

경력과 함께 반환 된 기술 목록은 항상 null로 돌아온 것으로 보인다. 나는 내가 얻으려고하는 대상에 대해 확실하지 않고, 문서가 실제로 도움이되지 않는다. 어떤 아이디어?

+0

반환 된 XML의 내용을 확인 했습니까? – njzk2

+0

어떻게해야할지 모르겠습니다. 나는 일식을 사용하고있다. – Will

답변

2

프로필 문서를 살펴보고 프로필 API가 작동하는 방식 및 제공되는 필드에 대한 아이디어를 얻는 것이 좋습니다. 기술이 r_fullprofile 멤버 허가를 필요로하는 필드의 설정은 "전체 프로필"의 일부입니다 : 예를 들어

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

을, 인증 된 사용자의 기술 세트를 검색하기 위해 호출은 다음과 같이 될 것이다 :

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

올바른 경우 데이터가 포함 된 xml 형식을 반환해야합니다. 당신은 응용 프로그램에서 그것을 분석하고 눈에 띄게 만들어야합니다.

1

인증 된 프로필 (본인)에 대해서는 이것을 얻을 수 있지만 네트워크에는 사용할 수 없습니다. 링크드 인의 연결 API 참조에서

: 1 정도 연결의

, 당신 만 r_basicprofile 회원 권한

사용할 프로필 필드 를 검색 할 수는 불행하게도, 링크드 API는 열려 있지 않습니다.

관련 문제