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 Status in LinkedIn



Overview

The following operations allow you to work with Statuses. Click an operation name to see details on how to use it.  

For a sample proxy service that illustrates how to work with status, see Sample configuration.

Operation

Description

getStatus

Get the current status of a user who has granted permission to the application

Operation details

This section provides details on each of the operations.

Get Status

Get the current status of a user who has granted permission to the application.

getStatus
<linkedin.getStatus>
	<memberId>{$ctx:memberId}</memberId>
    <publicUrl>{$ctx:publicUrl}</publicUrl>
</linkedin.getStatus>
Properties
  • memberId: ID of the member whose profile fields are requested to be retrieved.
  • publicUrl: Public URL of the requested profile.
Sample request

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

Sample request for getStatus
{
"accessToken":"AQV068KoSLBPT8UeiEdMufTAp6t78tvE1B8UAdqtOFIFkGIvCfLbxDlkLfnA5dLE2UYsbb7OJyOqAxE1gLGnl7utIi5dC7Osyz4v9Y54-xWALv-_eO-ZdAPYAc0ibfr36d43P3OHSFgjNe1Bgs1kbI3k1DWXpMKC7_N0_JsJFY8vdbkVQAs",
"apiUrl":"https://api.linkedin.com",
"publicUrl":"http://www.linkedin.com/pub/wso2connector-abdera/87/998/935",
"memberId":"12323"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to LinkedIn with the init operation and use the getStatus operation. The sample request for this proxy can be found in getStatus 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="getStatus"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="memberId" expression="json-eval($.memberId)"/>
         <property name="publicUrl" expression="json-eval($.publicUrl)"/>
         <linkedin.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </linkedin.init>
         <linkedin.getStatus>
            <memberId>{$ctx:memberId}</memberId>
            <publicUrl>{$ctx:publicUrl}</publicUrl>
         </linkedin.getStatus>
		 <property name="messageType" value="application/json" scope="axis2"/>
         <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"/>
                  </case>
               </switch>
               <sequence key="faultHandlerSeq"/>
            </then>
         </filter>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>
                                

 

Â