Share API

Share API

Reading and Creating Shares

Use the Share API to have a member share content with their network or with all of LinkedIn. This can be a simple short text update, similar to Twitter.  Or a URL with a title and optional photo. Or both.

You can also forward the shared content to Twitter and reshare another member’s share.

This feature replaces the deprecated Status Update API and fields.

Adding New Shares

To add a new share, you markup the content in XML and issue a  HTTP POST to the following URL:

URL

To have LinkedIn pass the status message along to a member’s tethered Twitter account, if they have one, modify the URL to include a query string of twitter-post=true.

Fields for the XML Body

Node Parent Node Required? Value Notes
share Yes Child nodes of share Parent node for all share content
comment share Conditional Text of member’s comment. (Similar to deprecated current-status field.) Post must contain comment and/or (content/title and content/submitted-url). Max length is 700 characters.
content share Conditional Parent node for information on shared document
title share/content Conditional Title of shared document Post must contain comment and/or (content/title and content/submitted-url). Max length is 200 characters.
submitted-url share/content Conditional URL for shared content Post must contain comment and/or (content/title and content/submitted-url).
submitted-image-url share/content Optional URL for image of shared content Invalid without (content/title and content/submitted-url).
description share/content Option Description of shared content Max length of 256 characters.
visibility share Yes Parent node for visibility information
code share/visibility Yes One of anyone: all members or connections-only: connections only.

Sample XML

Here is an example XML document:

<!--?xml version="1.0" encoding="UTF-8"?> 83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] -->http://bit.ly/cCpeOD Survey: Social networks top hiring tool - San Francisco Business Times http://sanfrancisco.bizjournals.com/sanfrancisco/stories/2010/06/28/daily34.html</submitted-url> <submitted-image-url>http://images.bizjournals.com/travel/cityscapes/thumbs/sm_sanfrancisco.jpg</submitted-image-url> </content> <visibility> <code>anyone</code> </visibility> </share>

Response

Returns 201 Created on success. It will also provide a Location HTTP header with a URL for the created resource. However, at this time, you cannot retrieve the Share from that location. It’s there for future compatibility.

Resharing An Existing Share

When a member does a reshare, they can pass along a previously shared item to their network. This can either be as-is, or they can annotate the share to provide their own thoughts. The process is similar to creating a new share, but you provide an attribution/id value instead of a content block.

You can only reshare a share with a content block. If this block is empty, you will get a 400 error saying “Specified share {s28311617} has no content”.

Read Retrieving Share Information for instructions to retrieve these value using the API.

URL

Fields for the XML Body

Node Parent Node Required? Value Notes
share Yes Child nodes of share Parent node for all share content
comment share No Text of member’s comment. (Similar to deprecated current-status field.) Max length is 700 characters.
attribution share Yes Parent node for information on reshared document
id share/attribution/share Yes id of reshared document Currently in the format of s12345678, so is not guaranteed to be an integer.Post must contain id if it does not contain content and id must be from a share with a content block.
visibility share Yes Parent node for visibility information
code share/visibility Yes One of anyone: all members or connections-only: connections only.

Sample XML

Here is an example XML document:

<!--?xml version="1.0" encoding="UTF-8"?> Check out this story! I can't believe it. s24681357 -->connections-only

Response

Returns 201 Created on success. It will also provide a Location HTTP header with a URL for the created resource. However, at this time, you cannot retrieve the Share from that location. It’s there for future compatibility.

Retrieving Share Information

A particular member’s current share is detailed in their Profile API, so you can get a member’s current share by requesting:

Use the ~, id, or public profile URL to identify the user.

To retrieve a stream of shares for the member or their member first degree network, use the Get Network Updates API resource requesting the SHAR update type.

For the specified member also use a query parameter of scope=self:

Omit the scope for their first degree network:

You will receive:

<!--?xml version="1.0" encoding="UTF-8"?> s12345678 1279577156654 83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] -->http://bit.ly/cCpeOD</comment> <content> <id>123456789</id> <title>Survey: Social networks top hiring tool - San Francisco Business Times</title> <submitted-url>http://sanfrancisco.bizjournals.com/sanfrancisco/stories/2010/06/28/daily34.html</submitted-url> <shortened-url>lnkd.in/abc123</shortened-url> <submitted-image-url>http://images.bizjournals.com/travel/cityscapes/thumbs/sm_sanfrancisco.jpg</submitted-image-url> <thumbnail-url>http://media.linkedin.com/media-proxy/ext...</thumbnail-url> </content> <visibility> <code>anyone</code> </visibility> <source> <service-provider> <name>LINKEDIN</name> </service-provider> <application> <name>Your Cool App</name> </application> </source> <current-share>

Fields for the XML Body

Beyond the fields listed above, you also receive:

Node Parent Node Value Notes
id share Identifier for share.
timestamp share Time of posting in miliseconds since UTC. (Divide this number by 1000 to get the standard Unix timestamp.)
shortened-url share/content Short version of the submitted-url. If the submitted-url is generated via a URL shortener, this is the original URL and the submitted URL is the expanded version. Otherwise, this is a LinkedIn generated short URL using http://lnkd.in/.
resolved-url share/content The submitted-url unwound from any URL shortener services.
author share/attribution/share Information on the author of the original shared item. Only appears when retrieving a reshare, not an original share.
name share/source/service-provider Platform where the share came from, such as LINKEDIN or  TWITTER.
name share/source/application Application where the share came from, such as the name of your application.
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: