Integration with LinkedIn
LinkedIn allows developers to extend their site or application by using the LinkedIn REST API. The integration itself is very straightforward. You just need an API Key, and some basic principles of the REST API [1]. In addition to that, the JavaScript API acts as a bridge between the user and the REST API, and gives you a way to interact with the the REST API without actually making calls — they requests are automatically translated into a REST call via Ajax.
REST API
Below you find the resources available for the LinkedIn API, as well as some basic description for each one of them.
- Profile
- Connections
- Search
- Messaging
- Network Updates
In this architecture, every resource is access via an HTTP GET request. The Profile resource provides all the information that is available for a user, based on selectors (user id or profile url). In order to get further information about a user’s network (connections, activity, etc.), Connections resource provides you with details regarding user’s connection. Searching through the LinkedIn network is achieved using the Search resource, which matches the criteria provided. Messaging resource allows users to send and receive private messages, as well as invitations to connect. Please note that, Messaging requires HTTP POST requests rather than GET. To post updates, receive updates, get comments and/or likes, you have to use the Network resource. Every HTTP request (either POST or GET), returns an XML with the appropriate data requested.
Request Examples
Search for people with keywords anargyros akrivos:
HTTP GET http://api.linkedin.com/v1/people-search?keywords=[anargyros akrivos]
Get profile information for user akrivos:
HTTP GET http://api.linkedin.com/v1/people/id=akrivos
Get akrivos‘ connections:
HTTP GET http://api.linkedin.com/v1/people/id=akrivos/connections
Getting updates for Vanessa Hughes
HTTP GET http://api.linkedin.com/v1/people/id=QpK8ApA59n/network/updates?scope=self
Response Example
<updates total="250" start="0" count="10">
<update>
<timestamp>1265688025372</timestamp>
<update-key>STAT-11737890-270-*1</update-key>
<update-type>STAT</update-type>
<update-content>
<person>
<id>QpK8ApA59n</id>
<first-name>Vanessa</first-name>
<last-name>Hughes</last-name>
<headline>Certified eBay Trading Asst & Power/TOP Seller of ANTIQUE WESTERN ITEMS</headline>
<current-status>I new I had a good plan & then I get this...Seller Special: 50% OFF SALE2 days only! Feb 9-10 #Ebay</current-status>
<picture-url>http://media.linkedin.com/mpr/mprx/0__by8vxfjBizcc5a135g1vpgtv6tBz_a13Le0vjpGEiQboFJPfTuuRge2Ue-enkf0CkYYssC1AxTS</picture-url>
<api-standard-profile-request>
<url>http://api.linkedin.com/v1/people/QpK8ApA59n:full</url>
<headers total="1">
<http-header>
<name>x-li-auth-token</name>
<value>name:D6nh</value>
</http-header>
</headers>
</api-standard-profile-request>
<site-standard-profile-request>
<url>http://www.linkedin.com/profile?viewProfile=&key=11737890&authToken=D6nh&authType=name&trk=api*a102812*s1397*</url>
</site-standard-profile-request>
</person>
</update-content>
<is-commentable>true</is-commentable>
</update>
...
</updates>
JavaScript API
Using JavaScript API [2] unleashes the full power of LinkedIn REST API. Assuming that you have the API Key, you just need to include a JavaScript provided by LinkedIn as follows:
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: YOUR-API-KEY
onLoad: onLinkedInLoad
authorize: true
</script>
The IN object is the basic JavaScript object for accessing the JavaScript API. Every function call begins with IN.
Issues to bear in mind
The basic issue is that many LinkedIn API calls require that the user is authenticated, making user authorisation a necessary evil, before making any call to the API.
References
[1] http://developer.linkedin.com/docs/DOC-1258
[2] http://developer.linkedin.com/docs/DOC-1206





