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.
final LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance("consumer_key","consumer_secret"); final LinkedInApiClient client = factory.createLinkedInApiClient("access_key","access_token");
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.
To fetch the profile of a person by ID.
Person profile = client.getProfileById(id); System.out.println("Name:" + profile.getFirstName() + " " + profile.getLastName()); System.out.println("Headline:" + profile.getHeadline()); System.out.println("Summary:" + profile.getSummary()); System.out.println("Industry:" + profile.getIndustry()); System.out.println("Picture:" + profile.getPictureUrl());
To get connections of the current user:
Connections connections = client.getConnectionsForCurrentUser(); System.out.println("Total connections fetched:" + connections.getTotal());
4.Network Updates API
To fetch network updates of the current user:
Network network = client.getNetworkUpdates(EnumSet.of(NetworkUpdateType.STATUS_UPDATE)); System.out.println("Total updates fetched:" + network.getUpdates().getTotal());