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



Overview

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

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

Operation

Description

getProfile

Returns details of LinkedIn profile

getMemberProfileThe Profile API returns a members profile info LinkedIn profile.

accessOutOfNetworkProfiles

Presents people resources that are outside of the current members' three degrees

getAdditionalProfileFieldsThe Profile API returns a members profile additional details of LinkedIn profile.
getProfiledataBasicThe Profile API returns a members profile basic info LinkedIn profile.

Operation details

This section provides details on each of the operations.

Getting profile information 

The Profile API returns a member's LinkedIn profile. This call returns one of two versions of the profile:

Standard: Displays the profile the requester is allowed to see. The specific content will depend on the privacy settings of the profile owner, the relationship (degree separation or groups in common) between the owner and the requester, and in rare cases, the privacy settings of the requester.

Public: Returns the public profile. The fields returned are only determined by the privacy settings of the profile owner.

getProfile - To get the LinkedInprofile via the public URL
<linkedin.getProfile>
	<memberId>{$ctx:memberId}</memberId>
    <publicUrl>{$ctx:publicUrl}</publicUrl>
    <fieldSelectors>{$ctx:fieldSelectors}</fieldSelectors>
    <secureUrls>{$ctx:secureUrls}</secureUrls>
</linkedin.getProfile>

Properties

  • memberId: If you know the member token of the profile you want to display, you can use it as the key value for this API call. You cannot use a member token to get a public profile.
  • fieldSelectors:  Field selectors are specified after the resource identifiers and path components of a resource, prefixed by a colon, contained within parentheses, and separated by commas. Fields will be returned in the order specified. When URL-encodes your resource URLs, ensure that the parentheses used in selectors remain un-escaped. Remember, each field you select adds computation time to your API request. It's best to be very specific as to what fields you want returned in each API call you make. 
  • publicUrl: Using the Public Profile URL will return a profile from inside or outside the logged in member's three degree network. The Public Profile URL must be URL escaped.
  • secureUrls: By providing the secure URLs parameters, it could be indicated that the URLs in the response should be in HTTPS.
Sample request

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

Sample request for getProfile - To get the LinkedInprofile via the public URL
{
"accessToken":"AQVT5aduaKoUktPuqxFD-KdGny8NyVOxY_F7wH53F050uf6SzqyfOSdxoU3wLgxLtQAnuskio7wWJIO9bIhxtJgikQ0DCX6ckNAAhDIx1yBpMOZsPtt7UvU0kgaxTdMGLk3X9Q7G_9NvvRNiliWx6UBY3Y_wCIQSfpu0KJrGyRCcT9_RAkE",
"apiUrl":"https://api.linkedin.com",
"publicUrl":"",
"fieldSelectors":"first-name,last-name",
"secureUrls":"true"
} 

Related LinkedIn documentation

https://developer.linkedin.com/docs/signin-with-linkedin

Retrieve Member Profile. 

This page is retrieves the informations about the member of the LinkedIn profile.

getMemberProfile
<linkedin.getMemberProfile>
    <basicProfileFields>{$ctx:basicProfileFields}</basicProfileFields>
</linkedin.getMemberProfile>

Properties

  • basicProfileFields: Basic profile fields to retrieve.

sample request 

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

Sample request for getMemberProfile
{
"apiUrl":"https://api.linkedin.com",
"accessToken":"AQUDwVyNpxmDdVgdBB0V3yOrdyeEpbaPoZveoYH5jH5p-dIVBRyGZoeU2l0JaHv4LhLa0sOjZgBkS2TCN8V5ilZ3h3pKb_2Nkym2gvSXEWyvg-wqbExzXuLS1s9oMRB_jzmVHSFGDbQCLczvqpi_IwbPSfnKjw4ySISwI5T_W44Q1cWQ2eY",
"basicProfileFields":"(id,num-connections,picture-url)"
}

Related LinkedIn documentation

https://developer.linkedin.com/docs/signin-with-linkedin

Retrieving basic profile data

This page is basic profile data for the user. The getProfiledataBasic call returns basic details of profile.

getProfiledataBasic
<linkedin.getProfiledataBasic/>
Sample request 

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

Sample request for getProfiledataBasic
{
"apiUrl":"https://api.linkedin.com",
"accessToken":"AQUDwVyNpxmDdVgdBB0V3yOrdyeEpbaPoZveoYH5jH5p-dIVBRyGZoeU2l0JaHv4LhLa0sOjZgBkS2TCN8V5ilZ3h3pKb_2Nkym2gvSXEWyvg-wqbExzXuLS1s9oMRB_jzmVHSFGDbQCLczvqpi_IwbPSfnKjw4ySISwI5T_W44Q1cWQ2eY"
}

Related LinkedIn documentation

https://developer.linkedin.com/docs/signin-with-linkedin

Retrieving additional profile fields

This page is additional profile data for the user. The LinkedIn getAdditionalProfileFields  call returns additional details of profile.

getAdditionalProfileFields
<linkedin.getAdditionalProfileFields>
    <additionalProfileFields>{$ctx:additionalProfileFields}</additionalProfileFields>
</linkedin.getAdditionalProfileFields>

Properties

  • additionalProfileFields: Additional profile fields to retrieve.
Sample request 

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

Sample request for getAdditionalProfileFields
{
"apiUrl":"https://api.linkedin.com",
"accessToken":"AQUDwVyNpxmDdVgdBB0V3yOrdyeEpbaPoZveoYH5jH5p-dIVBRyGZoeU2l0JaHv4LhLa0sOjZgBkS2TCN8V5ilZ3h3pKb_2Nkym2gvSXEWyvg-wqbExzXuLS1s9oMRB_jzmVHSFGDbQCLczvqpi_IwbPSfnKjw4ySISwI5T_W44Q1cWQ2eY",
"additionalProfileFields":"(id,num-connections,picture-url)"
}

Related LinkedIn documentation

https://developer.linkedin.com/docs/signin-with-linkedin

Accessing out-of-network profiles 

When you perform searches and a few other API actions on LinkedIn, you will often be presented with people resources that are outside of the current member's three degrees. They are called out-of-network profiles. To request profile information for a member that has a degree distance greater than three for the currently logged in member, pass us an additional authorization token to tell LinkedIn more about the context for this profile call.

accessOutOfNetworkProfiles
<linkedin.accessOutOfNetworkProfiles>
	<standardProfileHeader>{$ctx:standardProfileHeader}</standardProfileHeader>
    <memberId>{$ctx:memberId}</memberId>
	<fieldSelectors>{$ctx:fieldSelectors}</fieldSelectors>
</linkedin.accessOutOfNetworkProfiles>
Properties
  • standardProfileHeader: HTTP header value that is used to retrieve the profile details that are over three degrees.
  • memberId: ID of the person whose third degree's details are required.
  • fieldSelectors: Field selectors are specified after the resource identifiers and path components of a resource, prefixed by a colon, contained within parentheses, and separated by commas. Fields will be returned in the order specified. When URL-encoding your resource URLs, ensure that the parentheses used in selectors remain unescaped. Remember, each field you select adds computation time to your API request. It's best to be very specific as to what fields you want returned in each API call you make.

Sample request

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

Sample request for accessOutOfNetworkProfiles
{
"accessToken":"AQXVJBC42XVp1ReiKXRGcCAErKBZ45JwyUfMD1vEK5VX195oZIeHGGxzjO65RE4XD59i_xX0uo3eKy-Rf2zyEeYjwVwgDWesW7p849H3KuCsxi9S8qvzbWKDI8rRZETnz-Jn4PirYRYZM8bfSa3ZXQyrGSbMI23iR6iRR3CBk1LW_mFvc8s",
"apiUrl":"https://api.linkedin.com",
"memberId":"BGOqOY7UWb",
"standardProfileHeader":"NAME_SEARCH:UrnW",
"fieldSelectors":"id,first-name"
}

Related LinkedIn documentation

 http://developer.linkedin.com/documents/accessing-out-network-profiles

Sample configuration

Following is a sample proxy service that illustrates how to connect to LinkedIn with the init operation and use the getProfile operation. The sample request for this proxy can be found in getProfile 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_getProfile"
       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)"/>
         <property name="fieldSelectors" expression="json-eval($.fieldSelectors)"/>
         <property name="secureUrls" expression="json-eval($.secureUrls)"/>
         <linkedin.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
         </linkedin.init>
         <linkedin.getProfile>
            <memberId>{$ctx:memberId}</memberId>
            <publicUrl>{$ctx:publicUrl}</publicUrl>
            <fieldSelectors>{$ctx:fieldSelectors}</fieldSelectors>
            <secureUrls>{$ctx:secureUrls}</secureUrls>
         </linkedin.getProfile>
		 <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>