Probably a simple question but I haven't been able to find any tutorials for this. I'm using the linkedin api in java and implementing it on android. I'm able to get education, position and other information but I'm not sure how to retrieve skills. Here's what I have:
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;
}
The skills list returned with career always seems to come back null. I'm probably not sure about the object I'm trying to get and docs don't really help. Any ideas?