Pages

Tuesday, May 31, 2011

Company and Jobs - LinkedIn API

Now we can get company & job information available in LinkedIn using its API.This might help to show up the company & job deatils in applications.View .

You can check the below URL's by using a simple java program

Links to get company information in combination with LinkedIn data
1. To get the company information by giving the company domainhttp://api.linkedin.com/v1/companies?email-domain=kyyba.com
Output :



586336
Kyyba Inc


2. To get the company information by giving the company id
http://api.linkedin.com/v1/companies/586336:(id,name,description,industry,logo-url)

output :



586336
KYYBA Inc
Kyyba, Inc. is a Global provider of strategic staffing and managed services for the Information Technology and Engineering Clients
Kyyba service lines provide customers the following services:
Product and Software Development Services
Engineering and Design Services
Staff Augmentation Services
Outsourcing Services

Staffing and Recruiting
http://media.linkedin.com/mpr/mpr/p/2/000/050/2e0/322206a.png


3. To get the companies around the given area [us:84] http://api.linkedin.com/v1/company-search:(companies,facets)?facet=location,us:84 Output :






1028
Oracle

.
.
.



location
Location


us:0
United States
596338
false

.
.
.





4. To get company in which the token is createdhttp://api.linkedin.com/v1/people/~/following/companies

Output :





96307
Vision Tech Solutions


5. To get company to follow by the current userhttp://api.linkedin.com/v1/people/~/suggestions/to-follow/companies
I didn’t get any output data .

Links to get LinkedIn's jobs by company, industry and more to display relevant jobs to the users.
1. To get some job information in LinkedIn for the user
http://api.linkedin.com/v1/people/~/suggestions/job-suggestions
Output :






1641017

1333802

1441
Google


5EyneQPD-C
David
S.
test at Test Advantage

This position is based in Bangalore, India.
The area: Google.com EngineeringGoogle.com Engineering makes Google's services fast and reliable for hundreds of millions of users. Described as "software engineering for adrenaline junkies", the team combines software development, networking, and systems administration expertise to build and run massively distributed, fault-tolerant software system

Bangalore

.
.

50


2. To get some job information exsisiting in given area [US:84]http://api.linkedin.com/v1/job-search:(jobs,facets)?facet=location,us:84
Output :






1653582

1231
Symantec

Best in Industry

YRNg4JA8HX
Shyam Sundar
V.
Principal Recruiter at Symantec

 Symantec R&D in Pune has Senior Principal Software Engineer positions open. Interested and suitable candidates can apply. Role Details: Research and drive the adoption of new technologies to enhance existing product functionality • Provide technical vision and leadership necessary to grow the technical proficiency of the development teams• Mentor development teams in good architecture and des
Pune, Maharashtra

.
.

3. To get the particular job information by giving the JobId [jobid=1653560]
http://api.linkedin.com/v1/jobs/1452577:(id,company:(name),position:(title))
Output :




1653560

Tata Consultancy Services


Siebel Architect- Performance Management


4. To get some job bookmarcks
http://api.linkedin.com/v1/people/~/job-bookmarks

I didn’t get any output data .

Simple Java Program using LinkedIn API

The below program will helps you to fetch & view linkedIn data in a short time.

Follow this link to download the jars & to get token, secret to work with LinkedIn API

Simple Java Program. To get the LinkedIn details about the current user [Who created the token & secret key]


public static void main(String[] args) {

String linkedinKey = "C2E7PG.."; //Your LinkedIn key
String linkedinSecret = "9hyC6.. ";//Your LinkedIn Secret
OAuthConsumer consumer = new DefaultOAuthConsumer( linkedinKey,linkedinSecret);

OAuthProvider provider = new DefaultOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken",
"https://api.linkedin.com/uas/oauth/accessToken",
"https://api.linkedin.com/uas/oauth/authorize");

System.out.println("Fetching request token from LinkedIn...");
String authUrl;
try {
authUrl = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
System.out.println("Check the below link and grant this app authorization -You will get Pin Number.Copy it\n" + authUrl );
System.out.println("Enter the PIN code and hit ENTER when you're done:");
} catch (OAuthMessageSignerException e1) {
e1.printStackTrace();
} catch (OAuthNotAuthorizedException e1) {
e1.printStackTrace();
} catch (OAuthExpectationFailedException e1) {
e1.printStackTrace();
} catch (OAuthCommunicationException e1) {
e1.printStackTrace();
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String pin;
try {
pin = br.readLine();
System.out.println("Fetching access token from LinkedIn...");
provider.retrieveAccessToken(consumer, pin);
System.out.println("Access token: " + consumer.getToken());
System.out.println("Token secret: " + consumer.getTokenSecret());
URL url = new URL("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)");

HttpURLConnection request = (HttpURLConnection) url.openConnection();
consumer.sign(request);
request.connect();
System.out.println("Sending request to LinkedIn...");
String responseBody = convertStreamToString(request.getInputStream());
System.out.println("Response: " + request.getResponseCode() + " "
+ request.getResponseMessage() + "\n" + responseBody);

} catch (OAuthMessageSignerException e) {
e.printStackTrace();
} catch (OAuthNotAuthorizedException e) {
e.printStackTrace();
} catch (OAuthExpectationFailedException e) {
e.printStackTrace();
} catch (OAuthCommunicationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static String convertStreamToString(InputStream is) {

BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
}


Output

Fetching request token from LinkedIn...
Check the below link and grant this app authorization -You will get Pin Number.Copy it
https://api.linkedin.com/uas/oauth/authorize?oauth_token=dcb835667-a5d7-4e95-91f9-fde4b9b47e3a
Enter the PIN code and hit ENTER when you're done:
59278
Fetching access token from LinkedIn...
Access token: f0f94b3d-50b9-4549-bd96-5d1ea3ba7a9c
Token secret: f2b13c99-f206-4612-bf9e-2afc1387bc1a
Sending request to LinkedIn...
Response: 200 OK



GtYKzPiNkX
Sundari Shree
Gunasekaran
Software Engineer at Vision Tech Solutions


Note: By passing the different URL’s as parameter You can check all the available information in LinkedIn .

URL url = new URL("http://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url,headline)");

This URL is to get about the people information.