Commenting On & Reading Comments and Likes in Network Updates

Some Network Updates may have comments or likes attached to them. These kind of updates are called commentable network updates and  likeable network updates. They are indicated by the presence of the string "true" within the node of update/is-commentable and update/is-likeable.

Reading Comments and Likes When Retrieving Network Updates

When requesting network updates, some updates in the stream may be commentable and/or contain comments attached to them. Similarly, updates may be likable and/or contain likes. These types of updates have the following characteristics:

Node Parent Node Description
update updates parent node for a particular network update
update-key update Network updates have an update-key that uniquely identifies the network update. This is used to identify the update, so you can retrieve all comments and likes for an update, as well as for adding comments or likes to an existing update.
is-commentable update Will denote "true" when the update can be commented on
update-comments update Container node for comments on this network update, if it is commentable and has updates. A total attribute will indicate how many comments may exist for this update.
update-comment update-comments Container node for a specific comment on a network update
id update-comment Unique identifier for comment
sequence-number update-comment Chronological placement of comment on update, starting at 0 for the oldest.
timestamp update-comment Time of comment, in miliseconds since Unix epoch.
comment update-comment The actual text of the comment posted by the LinkedIn member
person update-comment Standard LinkedIn person object containing the following fields: id,first-name,last-name,headline,api-standard-profile-request,site-standard-profile-request
is-likeable update Will denote "true" when the update can be liked
num-likes update The total number of people who have liked an update.
likes update Container node for likes on this network update, if it is likeable and has likes. A total attribute will indicate how many likes exist for this update.
like likes Container node for a specific like on a network update
person like Standard LinkedIn person object containing the following fields: id,first-name,last-name, and headline

Sample Network Update With Comments and Likes XML

Most important here are update-key, is-commentable, update-commentsis-likeable, num-likes, and likes:

<network>
  <updates total="1">
    <update>
      <timestamp>1257187431000</timestamp>
      <update-key>STAT-54321-11</update-key>
      <update-type>STAT</update-type>
      <update-content>
        <person>
          <id>abcdefg</id>
          <first-name>Richard</first-name>
          <last-name>Brautigan</last-name>
          <headline>Author</headline>
          <current-status>is thinking about rivers.</current-status>
          <api-standard-profile-request>
            <url>https://api.linkedin.com/v1/people/abcdefg:full</url>
            <headers total="1">
              <http-header>
                <name>x-li-auth-token</name>
                <value>name:abcdefg</value>
              </http-header>
            </headers>
          </api-standard-profile-request>
          <site-standard-profile-request>
            <url>https://www.linkedin.com/profile?viewProfile=&amp;key=abcdefg&amp;authToken=abcdefg&amp;authType=name</url>
          </site-standard-profile-request>
        </person>
      </update-content>
      <is-commentable>true</is-commentable>
      <update-comments total="1">
        <update-comment>
          <id>22995112<id>
          <sequence-number>0</sequence-number>
          <timestamp>1284737901266</timestamp>
          <comment>You've got me thinking about trout.</comment>
          <person>
            <id>zyxwvut</id>
            <first-name>Gertrude</first-name>
            <last-name>Stein</last-name>
            <headline>Author</headline>
            <api-standard-profile-request>
              <url>https://api.linkedin.com/v1/people/dsfsf:full</url>
              <headers total="1">
                <http-header>
                  <name>x-li-auth-token</name>
                  <value>name:dsfsf</value>
                </http-header>
              </headers>
            </api-standard-profile-request>
            <site-standard-profile-request>
              <url>https://www.linkedin.com/profile?viewProfile=&amp;key=dsfsf&amp;authToken=dsfsf&amp;authType=name</url>
            </site-standard-profile-request>
          </person>
        </update-comment>
      </update-comments>
      <is-likable>true</is-likable>
      <is-liked>true</is-liked>
      <num-likes>1</num-likes>
      <likes total="1">
        <like>
          <person>
            <id>POfcN6JhcU</id>
            <first-name>George</first-name>
            <last-name>Washington</last-name>
            <headline>President, United States of America</headline>
          </person>
        </like>
      </likes> 
    </update>
  </update>
</network>

Getting More Comments and Likes on a Specific Network Update

By default, a network update containing more than 10 comments will only return you the most recent five. To retrieve all comments for a given network update:

Where {NETWORK UPDATE KEY} is a update/update-key representing an update. Returns all comments belonging to this network update, following the same structure as above.

Use a similar syntax to retrive the complete list of people who liked an update:

Adding a Comment or Like to a Network Update

When you want to post a new comment to an existing update:

  1. Ensure update/is-commentable is set to true
  2. Take the update/update-key from an existing update and POST to the following URL structure:

A successful comment POST will return a 201 Content Created status code.

Comments have a maximum length of 700 characters.

Network Update Comment XML POST Body

<?xml version='1.0' encoding='UTF-8'?>
<update-comment>
  <comment>Save me a trout, Richard!</comment>
</update-comment>  

To Like or Unlike an existing update:

  1. Ensure update/is-likeable is set to true
  2. Use the same update/update-key and PUT to the following URL:

A successful comment PUT will return a 201 Content Created status code.

Network Update Like XML POST Body

<?xml version='1.0' encoding='UTF-8'?>
<is-liked>true</is-liked>  

Network Update Unlike XML POST Body

The XML is similar to unlike, but you set the value to false instead of true:

<?xml version='1.0' encoding='UTF-8'?>
<is-liked>false</is-liked>