The LinkedIn API allows you to access LinkedIn data programmatically. To call the LinkedIn API from Postman, you need to follow these basic steps:
- Register an app on LinkedIn to get API keys
- Get an access token from LinkedIn to authenticate
- Make API calls using Postman
In this article, we’ll walk through each of these steps in more detail. We’ll also look at some examples of API requests you can make from Postman.
Register an App on LinkedIn
The first thing you need to do is register an app on LinkedIn to get your API keys. Here’s how:
- Go to https://www.linkedin.com/developers/ and log in with your LinkedIn account.
- Click on “Create Application”. Fill in the form details like application name, description, logo, application use, website URL, business email etc.
- Agree to the API terms of use and click “Submit”.
- On the next screen, copy and save the generated API Key and Secret Key.
This gives you a Client ID and Client Secret which act as your API keys. We’ll need these to authenticate when making API calls.
Get an Access Token
To call the LinkedIn APIs, you need an OAuth 2.0 access token. Here are the steps to get one:
- In Postman, click on the “Authorization” tab and select “OAuth 2.0” as the type.
- Fill in the following details:
- Grant Type: Client Credentials
- Access Token URL: https://www.linkedin.com/oauth/v2/accessToken
- Client ID: [Your API key]
- Client Secret: [Your secret key]
- Scope: r_liteprofile r_emailaddress
- Click “Request Token”. Postman will make a call to LinkedIn and return an access token.
- Copy this access token. We’ll need it to send in the Authorization header when making API calls.
This access token is temporary and will expire after a while. When that happens, just repeat the above steps to generate a fresh access token.
Make API Calls
Now we’re ready to make API calls to LinkedIn from Postman. Here are the steps:
- Create a new request in Postman.
- Select GET and enter the API URL you want to call. For example:
https://api.linkedin.com/v2/me
- Go to the “Authorization” tab and select “Bearer Token” as the type.
- Paste the access token you got in the previous step.
- Click “Send”. You should see a response from the LinkedIn API.
The API URL, headers, and request body will vary based on which LinkedIn API you are calling. Refer to the LinkedIn API documentation for more details.
Let’s look at some example API calls you can make from Postman.
Get Profile Details
To get the profile details of the currently authenticated user, send a GET request to:
https://api.linkedin.com/v2/me
Here’s an example response:
{ "id": "abcdef123", "firstName": { "localized": { "en_US": "John" }, "preferredLocale": { "country": "US", "language": "en" } }, "lastName": { "localized": { "en_US": "Doe" }, "preferredLocale": { "country": "US", "language": "en" } }, "profilePicture": { "displayImage": "urn:li:digitalmediaAsset:B54328XZFfe2134z" } }
Search People
To search for people on LinkedIn, send a GET request to:
https://api.linkedin.com/v2/people-search?keywords=john&count=10
This will search for profiles with “john” in the name and return up to 10 matches.
Here’s an example response:
{ "elements": [ { "localizedLastName": "John", "firstName": { "preferredLocale": { "country": "US", "language": "en" }, "localized": { "en_US": "Sara" } }, "profilePicture": { "displayImage": "urn:li:digitalmediaAsset:B54328XZFfe2134z" } }, { "localizedLastName": "Johnson", "firstName": { "preferredLocale": { "country": "US", "language": "en" }, "localized": { "en_US": "Tom" } } } ], "paging": { "count": 10, "start": 0, "links": [] } }
Share Content on Profile
To post content to the authenticated user’s LinkedIn profile, send a POST request to:
https://api.linkedin.com/v2/shares
With a JSON request body like:
{ "distribution": { "linkedInDistributionTarget": {} }, "owner":"urn:li:person:{linkedin-id}", "subject":"Check out this article!", "text": { "text":"I found this article very interesting - take a look! https://example.com/interesting-article" } }
This will share the link on the user’s profile. The response contains an ID for the newly created share:
{ "id": "s123456" }
Send InMail Messages
To send InMail messages programmatically, you can use the following API endpoint:
https://api.linkedin.com/v2/communicationsV2/sendInmails
Send a POST request with a JSON body like:
{ "recipients": { "recipients": [ { "profileId": "abcdef123" } ] }, "subject": "Let's connect!", "body": { "text": "Hi John, I'd love to connect with you!" }, "from": { "profileId": "1234567" } }
This will send an InMail to the profile ID specified from the authenticated user.
The response contains a message URN value on success:
{ "urn:li:fs_inmailMessage:987654321" }
Search Jobs
To search for jobs on LinkedIn, send a GET request like:
https://api.linkedin.com/v2/jobPostingSearch?keywords=python&location=San%20Francisco
This searches for jobs with “python” in the title located in San Francisco.
The response contains matching jobs:
{ "elements": [ { "id": "abcdef123", "title": "Senior Python Developer", "locations": [ { "name": "San Francisco, CA" } ] }, { "id": "456def789", "title": "Python Engineer", "locations": [ { "name": "Menlo Park, CA" } ] } ] }
There are many other endpoints you can call – see the LinkedIn API docs for more details.
Handle Errors
When calling APIs, you may sometimes get errors. LinkedIn uses standard HTTP status codes to indicate errors:
Status Code | Meaning |
---|---|
400 | Bad request – the request was malformed |
401 | Unauthorized – the access token was invalid |
403 | Forbidden – you don’t have permission to access the resource |
404 | Not found – the resource doesn’t exist |
429 | Too many requests – you’ve hit a rate limit |
500 | Server error – an unexpected error occurred on LinkedIn’s end |
When you get errors, check the status code and message returned to determine how to resolve the issue. Common problems include invalid access tokens, missing required parameters, hitting rate limits, or trying to access resources you don’t have permission for.
Conclusion
The LinkedIn API provides powerful capabilities to retrieve data and post content programmatically. By registering your app, getting an access token, and making API calls in Postman, you can integrate LinkedIn data into your own applications.
Some key points to remember:
- Register your app to get API keys
- Get an access token before making API calls
- Use the correct endpoints, headers, and request bodies
- Check for common errors like invalid tokens or rate limits
- Refer to the documentation for detailed guidance on all endpoints
With the LinkedIn API, the possibilities are endless for building apps that leverage LinkedIn’s rich social data. Whether it’s personalized content recommendations, recruiting tools, publishing tools, or more, the LinkedIn API helps bring the power of LinkedIn’s network to your apps.
Next Steps
To learn more about using the LinkedIn API, here are some helpful resources:
- LinkedIn API Docs – Full technical reference for all API endpoints.
- LinkedIn Getting Started Guide – Overview of integrating with LinkedIn.
- LinkedIn Node.js Tutorial – Walkthrough of building a Node app with the API.
- Postman LinkedIn API Collection – Pre-built collection of LinkedIn API requests.
The LinkedIn API opens up many exciting possibilities for developers. With the fundamental concepts covered in this guide, you should be well on your way to integrating LinkedIn data into your own apps!