/
Working with the User's Network in LinkedIn

This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with the User's Network in LinkedIn



Overview

The following operations allow you to work with User's Network. Click an operation name to see details on how to use it.  

For a sample proxy service that illustrates how to work with user's network, see Sample configuration.

Operation

Description

shareResources

Network updates serve as one of the core experiences on LinkedIn, giving users the ability to share rich content to their professional network.

Operation details

This section provides details on each of the operations. Share API

Network updates serve as one of the core experiences on LinkedIn, giving users the ability to share rich content in their professional network. Through the Share API, you can enable users to take full advantage of this functionality within your application. Use the Share API for:

  • Seamless integrations for user generated content distribution.
  • Custom integrations for sharing and re-sharing read articles.
  • Posting user activity and associated content.
shareResources
<linkedin.shareResources>
	<comment>{$ctx:comment}</comment>
    <title>{$ctx:title}</title>
    <description>{$ctx:description}</description>
    <submittedUrl>{$ctx:submittedUrl}</submittedUrl>
    <submittedImageUrl>{$ctx:submittedImageUrl}</submittedImageUrl>
    <code>{$ctx:code}</code>
</linkedin.shareResources>

Properties

  • comment: Text of member's comment. (Similar to deprecated current-status field.)
  • title: Title of shared document.
  • description: Parent node for information on shared document.
  • submittedUrl: URL for shared content.
  • submittedImageUrl: Required - URL for image of shared content.
  • code: Required - One of  anyone: all members, or connections-only: connections only.
Sample request

Following is a sample REST request that can be handled by the shareResources operation.

Sample request for shareResources
{
	"comment":"Check out the LinkedIn Share API!",
	"title":"LinkedIn Developers Documentation On Using the Share API",
	"description":"Leverage the Share API to maximize engagement on user-generated content on LinkedIn",
	"submittedUrl":"https://developer.linkedin.com/documents/share-api",
	"submittedImageUrl":"http://m3.licdn.com/media/p/3/000/124/1a6/089a29a.png",
	"code":"anyone",
	"accessToken":"AQXImsqaARriTxWZgU14P2kCov455xQcL4duyYlgoD4g2mlVdTEiwMLtK1iKYhscwCvzZErt1QbX50-f8iTW02DtSPGPUEPPvhkLsrQP3jDCFzvOHbIU47a-6yeLXBCmAXCS2Q9Etb-	R1BaSnbcohgmpMYYISVr_nmamqYlQ-SmvtKHdhs0",
	"apiUrl":"https://api.linkedin.com"
}

Related LinkedIn documentation

http://developer.linkedin.com/documents/share-api

Sample configuration

Following is a sample proxy service that illustrates how to connect to LinkedIn with the init operation and use the getNetworkUpdates operation. The sample request for this proxy can be found in getNetworkUpdates sample request.You can use this sample as a template for using other operations in this category.

 As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq".

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="linkedin_shareResources"
       transports="https http"
       startOnLoad="true"
       trace="disable">
    <description/>
    <target>
        <inSequence>
            <property name="accessToken" expression="json-eval($.accessToken)"/>
            <property name="comment" expression="json-eval($.comment)"/>
            <property name="title" expression="json-eval($.title)"/>
            <property name="description" expression="json-eval($.description)"/>
            <property name="submittedUrl" expression="json-eval($.submittedUrl)"/>
            <property name="submittedImageUrl" expression="json-eval($.submittedImageUrl)"/>
            <property name="code" expression="json-eval($.code)"/>
            <property name="apiUrl" expression="json-eval($.apiUrl)"/>
            <linkedin.init>
                <apiUrl>{$ctx:apiUrl}</apiUrl>
                <accessToken>{$ctx:accessToken}</accessToken>
            </linkedin.init>
            <linkedin.shareResources>
                <comment>{$ctx:comment}</comment>
                <title>{$ctx:title}</title>
                <description>{$ctx:description}</description>
                <submittedUrl>{$ctx:submittedUrl}</submittedUrl>
                <submittedImageUrl>{$ctx:submittedImageUrl}</submittedImageUrl>
                <code>{$ctx:code}</code>
            </linkedin.shareResources>
            <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]">
                <then>
                    <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/>
                    <switch source="$axis2:HTTP_SC">
                        <case regex="401">
                            <property name="ERROR_MESSAGE" value="Unauthorized"/>
                            <property name="error_description" expression="json-eval($.message)"/>
                        </case>
                        <case regex="403">
                            <property name="ERROR_MESSAGE" value="Forbidden"/>
                            <property name="error_description" expression="json-eval($.message)"/>
                        </case>
                        <case regex="404">
                            <property name="ERROR_MESSAGE" value="Not Found"/>
                        </case>
                        <case regex="400">
                            <property name="ERROR_MESSAGE" value="Bad Request"/>
                            <property name="error_description" expression="json-eval($.message)"/>
                        </case>
                    </switch>
                </then>
            </filter>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
</proxy>                       

Related content