SDKs overview

LinkedIn provides developers with resources, including SDKs and API documentation, to integrate its professional networking features into external applications. These integrations typically involve authenticating users, accessing profile information (with user consent), sharing content, and utilizing other platform functionalities. The availability and support for specific SDKs can vary depending on the API version and the specific endpoints being accessed. LinkedIn's developer program outlines the available APIs and associated guidelines for building applications.

The primary method for applications to interact with the LinkedIn platform is through its RESTful APIs, which utilize OAuth 2.0 for authentication and authorization. While LinkedIn previously maintained several official client libraries, their focus has shifted towards providing comprehensive API documentation and encouraging direct API consumption, or the use of community-contributed libraries where official SDKs are less prevalent or explicitly deprecated.

Official SDKs by language

While LinkedIn's developer portal emphasizes direct API calls and comprehensive documentation for its Marketing Solutions APIs and other services, some official or semi-official SDKs have been available or are maintained for specific use cases or older API versions. Developers are generally encouraged to consult the latest LinkedIn Developer Program documentation for the most current information regarding official client libraries and recommended integration practices. For newer API versions, direct HTTP requests with proper OAuth 2.0 handling are often the primary integration method. Community libraries frequently fill gaps for specific programming languages.

As of late 2024, LinkedIn's developer approach often prioritizes granular API access through RESTful endpoints over maintaining a full suite of language-specific SDKs for every API. However, for specialized products like LinkedIn Marketing Solutions, specific libraries or examples may be provided to facilitate integration. Developers should review the LinkedIn Developer Resources for the most up-to-date guidance on available client libraries and recommended integration methods for their specific use case.

Language Package / Description Typical Installation Command Maturity / Support
Java LinkedIn Java Client (community-driven, based on older APIs) Maven: <dependency><groupId>com.github.lorislab.linkedin</groupId><artifactId>linkedin-api</artifactId><version>2.0.0</version></dependency> Community maintained, older API focus. Direct API calls recommended for v2.
Python python-linkedin (community library) pip install python-linkedin Community maintained, often requires manual updates for new API features. Direct API calls recommended by LinkedIn.
JavaScript (Node.js) node-linkedin (community library) npm install node-linkedin Community maintained, generally for older API versions. Direct API calls with Axios/Fetch are common for v2.
PHP linkedin-sdk (community library) composer require hpatoio/php-linkedin-api Community maintained. Direct API calls recommended for newer integrations.

Installation

Installation procedures for LinkedIn-related SDKs and libraries largely depend on whether an official or community-contributed package is being used, and the specific programming language. For official API interactions, installation often involves setting up an HTTP client and an OAuth 2.0 library rather than a full LinkedIn SDK.

General Steps for Community Libraries:

  1. Identify the Library: Choose a library suitable for your programming language and target LinkedIn API version.
  2. Use Package Manager: Most languages have a standard package manager (e.g., pip for Python, npm for Node.js, Composer for PHP, Maven/Gradle for Java).
  3. Install Dependencies: Execute the appropriate installation command in your project directory.
  4. Configure Credentials: Obtain API credentials (Client ID and Client Secret) from your LinkedIn Developer Application.
  5. Set up Authentication: Configure the library to use OAuth 2.0 for user authentication, typically involving redirect URIs and scope requests.

For direct API calls, which is often LinkedIn's recommended approach for current API versions, installation involves:

  • HTTP Client Library: Install a robust HTTP client (e.g., Axios for JavaScript, Requests for Python, OkHttp for Java).
  • OAuth 2.0 Library: Implement an OAuth 2.0 client library to handle token exchange, refresh, and authorization headers. Many general-purpose OAuth libraries are available across languages (e.g., Google's OAuth 2.0 documentation provides general implementation guidance).

Quickstart example

This example demonstrates a conceptual Python quickstart using direct API calls combined with an OAuth 2.0 flow, which is the more common and recommended approach for modern LinkedIn API integrations. It assumes you have already initiated the OAuth 2.0 authorization code flow to obtain an access token.

Prerequisites:

  • A registered LinkedIn Developer Application with a Client ID and Client Secret.
  • An authenticated user with an access token and necessary permissions (scopes).

import requests

# Replace with your actual access token and other details
ACCESS_TOKEN = "YOUR_LINKEDIN_ACCESS_TOKEN"
PERSON_API_URL = "https://api.linkedin.com/v2/me"

headers = {
    "Authorization": f"Bearer {ACCESS_TOKEN}",
    "cache-control": "no-cache",
    "X-Restli-Protocol-Version": "2.0.0"
}

response = requests.get(PERSON_API_URL, headers=headers)

if response.status_code == 200:
    profile_data = response.json()
    print("Successfully retrieved profile data:")
    print(f"ID: {profile_data.get('id')}")
    print(f"First Name: {profile_data.get('firstName', {}).get('localized', {}).get('en_US')}")
    print(f"Last Name: {profile_data.get('lastName', {}).get('localized', {}).get('en_US')}")
else:
    print(f"Error retrieving profile data: {response.status_code}")
    print(response.json())

This Python snippet demonstrates how to make a GET request to the /v2/me endpoint to retrieve the authenticated user's profile data. The Authorization header includes the access token obtained through the OAuth 2.0 flow. The X-Restli-Protocol-Version header is crucial for ensuring the API responds with version 2.0.0 semantics, which is the current stable version for many endpoints.

Community libraries

Given LinkedIn's strategic shift towards comprehensive API documentation and direct RESTful interactions, community-contributed libraries play a significant role in providing language-specific wrappers and simplifying integration for various platforms. These libraries are developed and maintained by the developer community and may not always reflect the latest API changes or official recommendations.

Some popular community libraries include:

  • python-linkedin: A Python wrapper for the LinkedIn API, often used for older API versions, but still finding utility for specific tasks. Developers should verify its compatibility with the desired API endpoints.
  • node-linkedin: A Node.js module for interacting with the LinkedIn API, providing methods for authentication and data retrieval.
  • linkedin-sdk (PHP): A PHP library that assists in authenticating users and making API calls.
  • LinkedIn Java Client (various forks): Several open-source Java clients exist, often community-driven, to facilitate integration with LinkedIn's platform.

When selecting a community library, it is advisable to check its active maintenance status, recent commit history, and reported issues to ensure compatibility with current LinkedIn API versions and security practices. For critical applications, direct API integration following LinkedIn's official developer guides is generally recommended to ensure the most up-to-date and secure implementation.