Complete How to guide on LinkedIn API

The LinkedIn API, also known as the REST API is the heart of all programmatic interactions with LinkedIn.  All other methods of interacting, such as the JavaScript as well as the Mobile SDKs, are simply wrappers around the REST API to provide an added level of convenience for developers.  Hence as a result, even if you are doing mobile or JavaScript development, it’s still worth taking the time to familiarize yourself with how the REST API works and what it can do for you.

How is LinkedIn useful?

LinkedIn is a social network with over 460 million + users worldwide. It’s one of the major social networks (along with Facebook, Twitter and Google+). We, at AeroLeads consider it as a gold mine of sales information! Hence, maybe that’s why nearly every B2B salesperson is using LinkedIn to prospect. Also, like many sales products, it’s priced in a way that closing a deal or two completely justifies the cost.Aeroleads to find contact information using linkedin

LinkedIn API

Bring the power of the world’s largest professional network to your apps. By using the LinkedIn API you can use several LinkedIn services. LinkedIn has examined the value of offering an open API to all developers, and found the said program not to be in the company’s best interest. It would be restricting broad LinkedIn API use to a few simple use cases, including these specified by LinkedIn itself –

  • Allowing members to represent their professional identity via their LinkedIn profile using the Profile API.
  • Enabling the members to post certifications directly to their LinkedIn profile with the Add to Profile tools.
  • It also helps the members to share professional content to their LinkedIn network from across the Web leveraging the Share API.
  • Enabling companies to share professional content to LinkedIn with the Company API.
  • Reduce friction and get more sign-ups by allowing users to sign in with LinkedIn instead of creating a new account.
  • Minimize the cost and time associated with implementing your own login, profile management, password change and recovery workflows.
  • Personalize your sites and apps with up-to-date member profile data.

How to use the LinkedIn API?

Before going forward with how to use the LinkedIn API, one must first know the various data formats as well as he must understand the request throttling processes.

Requesting data from the APIs –

Unless otherwise specified, all of LinkedIn’s APIs will return the information that you request in the XML data format.

For example :

GET
https://api.linkedin.com/v1/people/~
 
sample response
<?xml version="1.0" encoding="UTF-8"?>
<person>
  <id>1R2RtA</id>
  <first-name>Frodo</first-name>
  <last-name>Baggins</last-name>
  <headline>Jewelery Repossession in Middle Earth</headline>
  <site-standard-profile-request>
    <url>https://www.linkedin.com/profile/view?id=…</url>
  </site-standard-profile-request>
</person>

If it is more convenient for your application to work with data in JSON format, you can request that APIs return you the JSON data using one of the following methods:

  1. Add a format=json URL argument to the end of your API call.
  2. Add this HTTP header to your API call: x-li-format: json

For example :

GET
https://api.linkedin.com/v1/people/~?format=json
sample response
{
  "firstName": "Frodo",
  "headline": "Jewelery Repossession in Middle Earth",
  "id": "1R2RtA",
  "lastName": "Baggins",
  "siteStandardProfileRequest": {
    "url": "https://www.linkedin.com/profile/view?id=…"
  }
}

Due to the unique natures of these two data formats, there are some subtle differences in the field identifiers you will encounter in the output. Make a sample API call using the format you intend your application to work with to ensure that you know exactly how to reference the information you are seeking within the response.

Sending data to the APIs –

Certain API calls (e.g. Share with LinkedIn) require you to send data in a particular format as part of the API call.  By default, all API calls expect input in XML format, however if it is more convenient for your application to submit data in JSON format, you can inform the APIs that they will be receiving a JSON-formatted payload by including the following two HTTP header values in the call:

  1. Content-Type: application/json
  2. x-li-format: json

Every API call that requires data to sent by POST or PUT has a different data structure that it expects in the payload.  Refer to the sample documentation for the specific call you are making to see the exact XML and JSON payload formats to complete your request.

Understanding request throttling –

All the LinkedIn API requests are throttled to prevent abuse as well as ensure stability.  The exact number of calls that your application can make per day varies based on the type of request you are making.  You will find this information along side the documentation for each specific API call.

There are three different kinds of throttles in place:

  • Application Throttle — The total number of calls that your application can make in a day.
  • User Throttle — The total number of calls that any unique individual member using your application can make in a day.
  • Developer Throttle — The total number of calls that any user that is identified as a “developer” in the Application’s settings can make in a day.

Please note that for the purposes of request throttling, the API server’s “day” is defined as the 24 hour period beginning at midnight UTC and ending at midnight on the following day.

Getting your LinkedIn API Key –

Now that we know the above concepts, the next step is to get your LinkedIn API key. This could help with various plugins that are used on LinkedIn.

For example, If you want to have advanced analytics you will need to specify your LinkedIn API key when configuring the CloudApply plugin. Hence, if you don’t already have a LinkedIn API key, you need one to use the Apply Plugin. Create a LinkedIn® API key and remember the API Key that is generated for you. It will look something like: d8amgl12v4ht. Also, if you already have a LinkedIn® API key, you can reuse it.

To retrieve your API Key –

  1. Navigate to https://devloper.linkedin.com/.
  2. Click Sign In.
  3. Log in using your LinkedIn® account credentials.
  4. Click OK, I’ll Allow It.
  5. From the Support menu, select API Keys.
  6. Click Add New Application.
  7. On the Add New Application page, complete the required information for each field, noting the following :
    • In the Application Name field, enter a name for the application (e.g., Acme Staffing LinkedIn® Integration).
    • In the OAuth User Agreement Default Scope field, select the following scope:
      • r_emailaddress,
      • r_contactinfo,
      • r_fullprofile
    • In the OAuth 2.0 Redirect URLs field, list the following, separating each by a comma:
    • In the JavaScript API Domains field, list the following, separating each by a comma:
    • Click Add Application.
    • On the Application Details page, copy the string of letters and numbers under the API Key and Secret Key fields and paste it into the API Key and Secret Key fields on the Configure Widget form back in ApplyMetrics; then complete the rest of the instructions above to finish enabling the integration.

 

LinkedIn API integration –

Hence, the final step is to use your perfect LinkedIn API. So, basically follow these simple steps :

Step 1 – Authenticate the user

The bulk of the work required to Sign In with LinkedIn is completed when you authenticate the current user.  If you do not have a previously stored access token the for the current user, follow the steps outlined in the Authenticating with OAuth 2.0 Guide to acquire a new access token that can be used in the next step of the Sign In process.

If required, you can download official LinkedIn button images to you in your project from the Image Resources section.

See Permissions and Limits to ensure that your application is requesting the correct member permissions for this API call during the OAuth 2.0 authentication process.

Step 2 – Retrieve basic profile data

Once you have obtained a valid access token for the user, you can use the following REST API call to retrieve basic profile data for the user :

GET
https://api.linkedin.com/v1/people/~?format=json
sample api response
{
  "firstName": "Frodo",
  "headline": "2nd Generation Adventurer",
  "id": "1R2RtA",
  "lastName": "Baggins",
  "siteStandardProfileRequest": {
    "url": "https://www.linkedin.com/profile/view?id=…"
  }
}

With this basic profile information in hand, the sign in process can be considered complete and its time for your application to continue the user experience.

Requesting additional profile fields –

LinkedIn does not return all possible member profile fields that are available to you by default. There is a limited selection of additional member fields that are also available to you which may be relevant to your application. Refer to the Basic Profile Fields page for a complete list of the basic member profile fields.

The following example demonstrates how to customize your API call to request specific member profile fields that you wish to be returned during the Sign In with LinkedIn workflow :

GET
https://api.linkedin.com/v1/people/~:(id,num-connections,picture-url)?format=json
sample api response
{
  "id": "1R2RtA",
  "numConnections": 42,
  "pictureUrl": "https://media.licdn.com/mpr/mprx/…"
}

Requesting alternate profile languages –

LinkedIn members have the opportunity to provide their profile information in multiple languages. To specify the language you would prefer to have returned, you include an Accept-Language HTTP header with your call. The value of the header should be a comma separated list of Language Codes, ordered from highest to lowest priority of preference.

Be aware that these are not localized or automatically translated values. The only non-English information available is information that was manually entered by the member.

sample http header
Accept-Language: es-ES, en-US, it-IT 

The header value is not strictly enforced, so the API will always try to return data whenever possible. If you specify a particular language and the member doesn’t have matching profile data, it will fall back to returning data in the member’s primary language rather than returning nothing at all.

 

So, hopefully this guide helps you with your LinkedIn API.

Our Reader Score
[Total: 11 Average: 2.7]

About Navaneetha

Navaneetha, popularly known as "nav", loves to read, play badminton, play the keyboard and sing but when she's not doing any of those, she loves to write. What started as a high school hobby to write is now her ongoing passion. At AeroLeads, she manages Inbound Marketing and Social Media Marketing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation