Connect with LinkedIn in java

Table of contents
Reading Time: < 1 minute

We needed to post LinkedIn updates in our gwt based application. LinkedIn-J is a java wrapper over LinkedIn API’s. We used this to post LinkedIn updates in our application.
We have also used signpost-core. It stands for simple oauth messages signing for java.
It exoposes a simple interface to sign HTTP requests using a given OAuth token and secret.

For getting this work we downloaded linkedin-j and signpost-core from the following location.
You can paste this jar in lib directory of your java based GWT application. Now our project is ready for using linkedin-j libraries.

Now the next step for calling any API method is to create the API client using the api key, api secret, access token, token secret.

Thats it! now you can interact with linkedin.

All the methods in the library are divided into these categories.

1.To send updates on linkedIn profiles.

2.Profile API
To fetch the profile of a person by ID.

3.Connections API
To get connections of the current user:

4.Network Updates API
To fetch network updates of the current user:

7 thoughts on “Connect with LinkedIn in java2 min read

  1. linkedin-j is not maintained. The author hasn’t updated it in months and it’s sorely lacking features available in updates to LinkedIn’s APIs.

  2. I got: {API Key, Secret Key, OAuth User Token, OAuth User Secret}, used them as {consumer_key, consumer_secret, access_key, access_token} not sure if this was correct but getting Error.

    Can any one guide what is the correct use of these two lines:
    factory = LinkedInApiClientFactory.newInstance(consumer_key, consumer_secret); // Correct ??
    client = factory.createLinkedInApiClient(OAuth_User_Token, OAuth_User_Secret);// Correct ??

  3. Can anyone please tell me the function to follow some one on linkedin in Linkedin-j api??

  4. I am getting the following error, please suggest why?
    Exception in thread “main” java.lang.NoClassDefFoundError: oauth/signpost/OAuthProvider
    at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory.createLinkedInOAuthService(LinkedInOAuthServiceFactory.java:69)
    at com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceFactory.createLinkedInOAuthService(LinkedInOAuthServiceFactory.java:57)
    at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3751)
    at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3725)
    at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.getProfileById(BaseLinkedInApiClient.java:1044)
    at com.msceia.form.Test.main(Test.java:22)
    Caused by: java.lang.ClassNotFoundException: oauth.signpost.OAuthProvider
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading