javalinkedin-apilinkedin-j

LinkedIn-J does not return educations


I am using LinkedIn-J. My application authenticates without problem, I get data from the user - even their first name, last name etc.

Person profile = client.getProfileForCurrentUser();
profile.getFirstName();

However, when I try to get the list of educations, the Educations object returned is null:

Educations educations = profile.getEducations();
educations == null

What can be the error? Should my application ask for special permissions to be granted?


Solution

  • I've never used the Linkedin-j api before, but according to the LinkedIn api you get firstname, lastname, headline, and some url by default.

    So I believe you need to specify that you want education returned. I don't know how to do that in LinkedIn-J though.

    http://developer.linkedin.com/documents/profile-api

    For example, with the rest api you'd use this uri:

    http://api.linkedin.com/v1/people/id=12345:(first-name,last-name, educations)
    

    Using the LinkedIn J library, it seems like you have to add profile fields using Set as a parameter to one of their many methods in the client.

    Example of a method you could call of many (if you have a connected user):

    public Person getProfileForCurrentUser(Set<ProfileField> profileFields)
    

    ProfileField is an Enum located here:

    import com.google.code.linkedinapi.client.enumeration.ProfileField;