springlinkedin-apispring-socialspring-social-linkedin

Get courses from Spring Social LinkedIn API


People often list their taken courses from universities at linkedIn.

Does anyone know if it is possible to fetch these courses using Spring Social?

im using:

<org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
<org.springframework.social.linkedin-version>1.0.0.BUILD-SNAPSHOT</org.springframework.social.linkedin-version>     
<org.springframework-version>3.2.3.RELEASE</org.springframework-version>
<org.springframework.security-version>3.1.4.RELEASE</org.springframework.security-version>

The closest I found is the education object, but it doesn't seem to contain the courses.

linkedin.profileOperations().getUserProfileFull().getEducations()

Solution

  • As of now there is no support for fetching courses.

    However, I added a improvement issue in spring socials tracker here

    And I found an alternative way of fetching the courses by rest operations.

        Connection<LinkedIn> connection = connectionRepository.findPrimaryConnection(LinkedIn.class);
        if (connection != null) {
            LinkedIn linkedin = connection.getApi();
            String url = String.format("https://api.linkedin.com/v1/people/id=%s:(courses)", linkedin.profileOperations().getProfileId()); 
            String jsonData = linkedin.restOperations().getForObject(url, String.class);
    
            JSONObject obj = new JSONObject(jsonData).getJSONObject("courses");
            JSONArray courseArray = obj.getJSONArray("values");
            JSONObject course = courseArray.getJSONObject(0);
    
            String name = course.getString("name");
            System.out.println("This is the name of the first course: " + name);
        }
    

    To see what university a course belongs to seems hard. Couldn't solve that part.