Recent changes in LinkedIn API
Posted By : Roomani Bajaj | 12-Sep-2012
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 :)
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Roomani Bajaj
Roomani is an avid technology enthusiast with years of industry experience. With her expertise in SaaS, Blockchain, and web and mobile development, she can help your development teams stay updated with the latest advancements and ensure that your projects are on the cutting edge. As the head of the Oodles Technology Business Unit her responsibilities likely include overseeing the software development process, managing the team of software developers, coordinating with the business development team to identify new opportunities, and working with the marketing team to promote and market the company's products and services. Roomani plays a crucial role in driving the success of our organization by driving innovation, nurturing collaboration among teams, and ensuring that your technology offerings align with the needs and expectations of your clients.