Blog

  • 12 Sep-12

    Integration of social apps like Facebook/LinkedIn is a common feature which various applications require these days. One of the common LinkedIn API available is linkedin-j. It exposes various methods to fetch Linkedin data like person's profile information, connections, recommendations, groups etc. This jar file is available at: http://code.google.com/p/linkedin-j/

    However, recently Linkedin made some changes in its API which now requires special permissions to access user's LinkedIn data. So if any application has been using linkedin-j API, and if the keys (application key and application secret) generated by API have been generated with the old LinkedIn API, then it would fetch the correct LinkedIn data. But if we generate new API keys and then try to access user's LinkedIn data, we would get exceptions like 'Access denied" from the API.

    The new permissions which LinkedIn now require are:

     

    Permission Description Scope Primary Endpoints
    Your Profile Overview Name, photo, headline, and current positions r_basicprofile GET /people/~
    *see person field list
    Your Full Profile Full profile including experience, education, skills, and recommendations r_fullprofile GET /people/~
    *see person field list
    Your Email Address The primary email address you use for your LinkedIn account r_emailaddress GET /people/~/email-address
    Your Connections Your 1st and 2nd degree connections r_network GET /people/~/connections

    GET /people/~/people-search
    Your Contact Info Address, phone number, and bound accounts r_contactinfo GET /people/~

    *see person field list
    Network Updates Retrieve and post updates to LinkedIn as you rw_nus GET /people/~/network/updates

    POST /people/~/shares
    Group Discussions Retrieve and post group discussions as you rw_groups GET & POST /groups

    GET & POST /posts

    GET & POST /people/~/group-memberships
    Invitations and Messages Send messages and invitations to connect as you w_messages POST /people/~/mailbox

     

    Hence to implement these permissions in the linkedin-j API, we need to make changes in the jar file, and include the permissions in the URL required to fetch the request token. Steps for this are:

    1. Extract linkedin-j.jar file.

    2. Within the extracted folder, open com\google\code\linkedinapi\client\constant\LinkedInApiUrls.properties.

    3. Change the value of com.google.code.linkedinapi.client.oauth.requestToken from "https://api.linkedin.com/uas/oauth/requestToken" to "https://api.linkedin.com/uas/oauth/requestToken?scope=r_network+w_messages+rw_nus+rw_groups".

    4. You can also add any additional permissions as per your requirement.

    5. Create the jar file again.

    With this new linkedin-j.jar, you will be able to access the LinkedIn data again. Happy exploring LinkedIn API :)

     

Tags: linkedin

View All PostsLeave a Comment

Comments

comments powered by Disqus