Skip to content

LinkedIn APIs: The power of REST via JavaScript

April 18, 2011

In previous posts I’ve written about LinkedIn’s REST API and embeddable widgets.  In this post I want to show you how you can bring the power of their REST API to bear in Ajax apps using the LinkedIn JavaScript API.

LinkedIn says the following on its JSAPI reference page:

This API bridges between the user’s browser and our REST endpoint. As a developer, you use a simple, consistent JavaScript interface to interact with the fundamental LinkedIn data types (Profiles, Connections, People Search, etc). Under the hood, we translate your request into a REST call which we make on your behalf via Ajax. All the details of cross domain Ajax and OAuth 2 are abstracted away – you simply invoke a method and receive JSON in return.

The API reference lists a number of actions you may wish to perform and provides examples of each of them.  Some of the available actions include initializing the framework, accessing data about LinkedIn members (the bulk of the API), rendering login and share buttons, authentication, event, and UI features.  I’ve provided a couple of examples below to give you a feel for what’s possible.

First, if you want to use the JSAPI in your browser app, you will need to have the user login.  This gives you access to their member information.  To create a “Sign in with LinkedIn” button like this:

https://i2.wp.com/developer.linkedin.com/servlet/JiveServlet/downloadImage/102-1224-8-1125/-1--1/signin_with_linkedin.png

you simply need to include this bit of JavaScript in your site page(s):

<script type="IN/Login" data-onAuth="[onAuthCallback]" data-onLogout="[onLogoutCallback]"> 
[TEMPLATE]
</script>

where you may use the templating capabilities described in the reference page in place of the template placeholder above.

Click here to read the complete post on the PayPal X Developer Network including a people search example which uses the LinkedIn JavaScript API Developer Console.

LinkedIn JavaScript console with PeopleSearch example

Advertisements

From → Uncategorized

Comments are closed.