0

次のリンクの「Network Updates API」の例を使用すると、client.postNetworkUpdate(updateText) を使用して問題なくネットワークの更新を投稿できます。

http://code.google.com/p/linkedin-j/wiki/GettingStarted

したがって、投稿はうまく機能します。ただし、更新を投稿しても、コメント、いいねなど、投稿自体の統計を取得するために使用される「UpdateKey」は返されません。UpdateKey がないと、統計を取得できません。だから私がしたいのは、投稿してから getNetworkUpdates() 関数を使用して最後の投稿を取得することです。その取得では、後で統計を取得するために使用する必要がある UpdateKey になります。ネットワーク アップデートを取得する方法に関する Java のサンプル スクリプトを次に示しますが、これは Java ではなく Coldfusion で行う必要があります。

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

Coldfusion を使用してこれを達成する方法について考えている人はいますか?

ありがとう

4

2 に答える 2

0

また、socialauthライブラリを使用して、更新を取得し、LinkedInにステータスを投稿することもできます。
http://code.google.com/p/socialauth

于 2013-01-11T14:20:14.490 に答える
0

私はその API を使用していませんが、最初の 2 行を使用して更新の数を取得できると思います。次に、オーバーロードclient.getNetworkUpdates(start, end)されたメソッドを使用して最後の更新を取得し、そのキーを取得します。

完全にテストされていませんが、これらの行に沿った何か:

<cfscript>
    ... 
    // not sure about accessing the STATUS_UPDATE enum. One of these should work:
    // method 1 
     STATUS_UPDATE = createObject("java", "com.google.code.linkedinapi.client.enumeration.NetworkUpdateType$STATUS_UPDATE");
    // method 2
    NetworkUpdateType = createObject("java", "com.google.code.linkedinapi.client.enumeration.NetworkUpdateType");
    STATUS_UPDATE = NetworkUpdateType.valueOf("STATUS_UPDATE");

    enumSet = createObject("java", "java.util.EnumSet");
    network = yourClientObject.getNetworkUpdates(enumSet.of(STATUS_UPDATE));
    numOfUpdates = network.getUpdates().getTotal(); 
    // Add error handling in case numOfUpdates = 0
    result = yourClientObject.getNetworkUpdates(numOfUpdates, numOfUpdates); 
    lastUpdate = result.getUpdates().getUpdateList().get(0);
    key = lastUpdate.getUpdateKey();
</cfscript>   
于 2012-01-20T23:54:46.510 に答える