【问题标题】:Get courses from Spring Social LinkedIn API从 Spring Social LinkedIn API 获取课程
【发布时间】:2023-03-28 16:25:02
【问题描述】:

人们经常在linkedIn 上列出他们从大学学习的课程。

有谁知道是否可以使用 Spring Social 获取这些课程?

我正在使用:

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

我找到的最接近的是教育对象,但它似乎不包含课程。

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

【问题讨论】:

    标签: spring linkedin spring-social spring-social-linkedin


    【解决方案1】:

    目前不支持获取课程。

    不过,我在 spring socials tracker here 中添加了一个改进问题

    我找到了另一种通过休息操作获取课程的方法。

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

    要查看一门课程属于哪所大学似乎很难。无法解决该部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 1970-01-01
      • 1970-01-01
      • 2013-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多