【问题标题】:Processing pagination in LinkedIn API在 LinkedIn API 中处理分页
【发布时间】:2014-05-04 00:32:31
【问题描述】:

我正在尝试使用linkedin-j API 检索我的所有网络更新。我可以获取前 10 个更新,但不知道如何再检索。

以下代码检索前 10 个更新:

Network network = client.getNetworkUpdates(EnumSet.of(NetworkUpdateType.STATUS_UPDATE));
System.out.println("Total updates fetched:" + network.getUpdates().getTotal());
for (Update update : network.getUpdates().getUpdateList()) {
        System.out.println("-------------------------------");
        System.out.println(update.getUpdateKey() + ":" + update.getUpdateContent().getPerson().getFirstName() + " " + update.getUpdateContent().getPerson().getLastName() + "->" + update.getUpdateContent().getPerson().getCurrentStatus());
        if (update.getUpdateComments() != null) {
                System.out.println("Total comments fetched:" + update.getUpdateComments().getTotal());
                for (UpdateComment comment : update.getUpdateComments().getUpdateCommentList()) {
                        System.out.println(comment.getPerson().getFirstName() + " " + comment.getPerson().getLastName() + "->" + comment.getComment());                         
                }
        }
}

还有另一种方法称为network.getUpdates().getStart(),,但我不知道如何实现它。我已经在这几个小时了,任何建议都将不胜感激。

【问题讨论】:

    标签: java pagination linkedin linkedin-j


    【解决方案1】:

    如果你想在linkedin-j 中使用分页,那么你可以使用getNetworkUpdates(Set, int, int) 和network.getUpdates().getTotal()。

    public Network getNetworkUpdates(Set<NetworkUpdateType> updateTypes, int start, int count);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-29
      • 2013-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-18
      • 2020-02-24
      相关资源
      最近更新 更多