Hi Folks,
I am back again teaching you some stuffs about Linked In API. I was asked to do this assignment by one of my friend actually. I googled for some times and I realized that there only few blogs and sites or very less people have done something using linked in api and exposed in their sites or blogs. So I thought of exposing it on my blog.
Image may be NSFW.
Clik here to view.
Here is the problem definition: Create a web application using any technology that accepts the name of a person/organization and displays all relevant information of the person/organization from linkedin. Also, there should be a link to view the user/organization profile in linkedin.
Since I am kinda of comfortable with javascript, I choosed javascript API.
PS: One should have a public hosting space and also domain to make this project running. Most of the social media which uses oAuth enforces developer to have a public hosting space and also domain.
The disadvantage with linked in API is one should have a main domain, one cant map it to sub domain.
Before you start hacking this code, make sure you have gone through the following link and have understood well.
http://developer.linkedin.com/javascript
Here is the complete code.
<!DOCTYPE html> <html> <head> <title>People Search Example</title> <script type="text/javascript" src="http://platform.linkedin.com/in.js"> api_key: add_your_api_key_here authorize: true </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link media="all" type="text/css" href="http://developer.linkedinlabs.com/tutorials/css/jqueryui.css" rel="stylesheet"/> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5b1.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script><script type="text/javascript"> function loadData() { var searchVal=document.getElementById("searchid").value; document.getElementById("search").style.visibility="hidden"; IN.API.PeopleSearch() .fields("firstName", "lastName", "distance", "publicProfileUrl","pictureUrl") .params({"keywords": searchVal, "count": 10, "sort": "distance"}) .result(function(result) { profHTML = "<h4 style='color:white;'>People search results for keyword"+searchVal+":</h4>"; for (var index in result.people.values) { profile = result.people.values[index] if (profile.pictureUrl) { profHTML += "<p><a href="" + profile.publicProfileUrl + "">"; profHTML += "<img height=30 align="left" src="" + profile.pictureUrl + ""></a>"; profHTML += "<p>" + profile.firstName + " " + profile.lastName +" (" + profile.distance + ")</p>"; } } $("#search").html(profHTML); }); } function show() { document.getElementById("search").style.visibility="visible"; } </script></head> <body class="yui3-skin-sam yui-skin-sam" style="background-color:#38ACEC"> <div id="search" style=" color:white; font-family:sans-serif;"> </div> <script type="IN/Login" data-onAuth="loadData"></script> <label style="color:white; font-family:sans-serif;">Enter the name you want to search:</label> <input type="text" id="searchid"/> <input type="button" value="search" onclick=" loadData();show();" style="width: 120px; height:30px; background-image:url('123.jpg');border:solid; border-color:white; color:white;"/> </body> </html>