Question

I'm trying to retrieve all of my network updates using the linkedin-j API. I can fetch the first 10 updates, but do not know how to retrieve any more.

The following code retrieves the first 10 updates:

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

There is another method called network.getUpdates().getStart(), but I don't know how to implement it. I've been at this for hours, and any advice would be appreciated.

Was it helpful?

Solution

If you would like to use pagination in linkedin-j, then you could use getNetworkUpdates(Set, int, int) along with network.getUpdates().getTotal().

public Network getNetworkUpdates(Set<NetworkUpdateType> updateTypes, int start, int count);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top