LinkedIn’s API allows you to integrate LinkedIn data and functionality into your own applications. To work with LinkedIn’s API, you’ll need to register your app, get API keys, and make authenticated requests. Postman is a useful tool for testing APIs like LinkedIn’s. With Postman, you can easily make API requests and view responses without having to write any code.
In this guide, we’ll walk through how to test LinkedIn’s API in Postman. We’ll cover:
- Registering a LinkedIn app
- Getting API keys
- Making authenticated requests
- Testing API endpoints
By the end, you’ll understand how to fully test LinkedIn’s API using Postman.
Prerequisites
Before we dive in, you’ll need:
- A LinkedIn account
- Postman installed (get it here if you don’t have it)
Having a basic understanding of APIs and Postman will be helpful as well.
Register a LinkedIn App
First things first, you’ll need to register an app on LinkedIn to get API access. Here’s how:
- Go to LinkedIn for Developers and log in with your LinkedIn account.
- Click on My Apps in the top menu bar.
- Click the Create App button.
- Fill in details for your app:
- Name
- Description
- Application logo
- Application use
- Website URL
- Business email
- Privacy policy URL
- Terms of service URL
- Agree to the API Terms of Use and click Submit.
Once your app is created, you’ll be taken to your app dashboard. This is where you can get your API keys and configure app settings.
Get API Keys
To make authenticated requests to LinkedIn’s API, you’ll need two API keys:
- Client ID – Identifies your app
- Client Secret – Authenticates your app
Here’s how to get these keys:
- From your app dashboard, click on Auth in the left sidebar.
- Under Client ID, copy the displayed Client ID.
- Click Generate client secret.
- Copy the displayed Client Secret.
Keep these keys private – anyone with them can make API requests on behalf of your app!
Make Authenticated Requests
Now we’re ready to make authenticated API requests. Here are the steps:
- Open Postman.
- Create a new request. Select GET as the request method.
- For the request URL, use this template:
https://api.linkedin.com/v2/{API_ENDPOINT}?oauth2_access_token={ACCESS_TOKEN}
Replace {API_ENDPOINT} with the actual endpoint you want to call.
- For {ACCESS_TOKEN}, you’ll need to generate an OAuth 2.0 access token. In Postman, click on the Authorization tab, then select OAuth 2.0 as the type.
- Configure the following settings:
- Grant Type: Client Credentials
- Access Token URL: https://www.linkedin.com/oauth/v2/accessToken
- Client ID: {Your Client ID}
- Client Secret: {Your Client Secret}
- Scope: r_liteprofile r_emailaddress w_member_social
- Click Request Token. This will generate an access token you can use in the request URL.
- Click Send to make the API request!
This process allows you to authenticate your requests and access LinkedIn’s API. The access token is only valid for 60 minutes – after that, you’ll need to generate a new one.
Test API Endpoints
Now for the fun part – testing LinkedIn’s API endpoints! Here are some ideas to get you started:
Profile API
The Profile API allows you to retrieve profile data. Try these endpoints:
- /me – Get the authenticated user’s profile
- /id={user_id} – Get a user’s profile by ID
- /emailAddress?q=members&projection=(elements*(handle~)) – Search for members by email address
Example response:
{
"firstName": "John",
"lastName": "Smith",
"headline": "Software Engineer at ABC Company",
"id": "1234567890"
}
Share API
The Share API allows you to share content on LinkedIn. Try these endpoints:
- /shares – Post a share
- /comments – Post a comment
Example request body:
{
"comment": "Test comment",
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
Jobs API
The Jobs API allows you to post and search jobs. Try these endpoints:
- /jobs?keywords=developer – Search jobs by keywords
- /jobs – Post a job
Example response:
[
{
"id": "12345678",
"companyName": "XYZ Corporation",
"position": "Software Engineer",
"descriptionSnippet": "We are looking for a talented software engineer..."
},
{
"id": "12345679",
"companyName": "ABC LLC",
"position": "Front End Developer",
"descriptionSnippet": "Seeking a qualified front end developer..."
}
]
Those are just a few ideas – check out the full LinkedIn API documentation for all the possibilities! Play around with different endpoints to see the types of data you can retrieve and actions you can perform.
Best Practices
Here are some recommendations when testing LinkedIn’s API in Postman:
- Read the documentation! Understanding endpoints, parameters, headers, and expected responses will help debugging.
- Use Postman’s code snippets to save code blocks for reuse.
- Add tests to validate responses (e.g. status code, body contents).
- Check the rate limits in response headers.
- Use Postman’s API monitoring to track usage over time.
- Generate a new access token when your current one expires.
Following API best practices will lead to a smooth testing experience.
Conclusion
Testing LinkedIn’s API in Postman provides a fast and easy way to explore the capabilities and integrate them into your own application. The key steps are:
- Register a LinkedIn app
- Get API keys (Client ID and Secret)
- Make authenticated API requests
- Explore different API endpoints
As you test the API, be sure to follow best practices around organizing your requests, validating responses, and staying within rate limits.
With Postman and a bit of setup, you’ll be ready to leverage the power of LinkedIn’s API in your own project!