Saturday, December 22, 2012

Creating Apps by extending LinkedIn API.

Last few days I have worked with two small applications that extend power of LinkedIn platform using LinkedIn API.

LinkedIn has opened its platform through its REST API and Javascript API. The platform allows you to

Get Profiles Details
Get Jobs.
Get Details of Companies.
Get Groups.
Get Connections.
Do a People Search.

Idea of the First Application was to find the Job Openings by distance when a user enter his skills.

So if you enter "Java" in skills. You get the Jobs list. Starting from nearest to farthest.

Idea of Second Application was to display Profile Information of users of a company.

So if you enter FirstName LastName and Company Name then you can get detailed profile of a person. If you already have a company intranet where you have firstname and lastname of most of its users you can directly see the profile details without the need to enter the basic information.

Though the steps to connect to linkedin API and documentation is available on http://developer.linkedin.com/  site but i will write the generic steps that i took for using the API.

The REST API allows you to access protected resources available with linkedin with the help of REST URL's for example if you want to search a User with FirstName = "Sushil" LastName="Bharwani" Company="XYZ" then you will send a REST URL request like...

http://api.linkedin.com/v1/people-search?first-name=sushil&lastname=bharwani&company-name=xyz.

But before hitting this URL and accessing the resources you have to authorize your App through OAuth (An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications).

There are several OAuth Protocol implementations available in Market. I tried first using the PHP_OAuth.dll file but could not configure it so i decided to move to java implementation and found. Java Scribe Library.

The sample application didnt worked fine in the starting since i had to apply some hacks for people search as suggested in some of the similar questions.

The suggestions were on Extending the LinkedInAPI class to add r_fullprofile and r_network fields in the authorization url.

When i did performed these changes and ran the code. It gave me a authorization URL. The URL was supposed to be pasted in browser to get a token. When the token is typed in the desired location an XML based result is returned with details asked in the REST call.

So with a few small modifications i was able to query the Linkedin platform using the REST API services that it has provided.

In the Job search application similar call was made to LinkedIn Job search API which returned me a list of locations with their lat long information in JSON Format. I utilized this info and combined it to google distance API to find the matching jobs by distance.

No comments:

Post a Comment