DEV Community

AC Nice
AC Nice

Posted on

How to create LinkedIn Job API using Python

Content

  • Intro
  • Requirements
  • What you can use LinkedIn Jobs API for
  • Getting Started
  • Install the Python libraries
  • Quick Usage From Python Interpreter
  • Job Search API
  • Jobs API

Intro

Creating your own LinkedIn Job RESTful API can be an amazing way to build customized job openings applications, or even build a service around the data you’ve collected, or it can fairly be a fun personal project that allows you to learn a new skill.

An API is an acronym for Application Programming Interface.

It is a set of functions or procedures that serves as an interface for connecting an application's services, data and functionalities with other independent service providers, operating systems etc.

While this may seem like an intimidating task at catch of a glimpse, it’s actually in every aspect easy.

Requirements

To gain access to this API, we will need:

  • A LinkedIn Account and Working page
  • Python 3 programming language
  • A terminal or Code editor

The LinkedIn API provides a service that lets people take their LinkedIn profiles and networks with them to other sites or applications via an OAuth based interface.

What you can use LinkedIn Jobs API for

The LinkedIn Jobs API can be applied in the following cases and more:

  • Job postings crawling
  • Create and manage jobs
  • Promote jobs
  • Manage jobs lifecycle
  • Job openings and career analysis and many more.

By the end of this tutorial you will be able to do and understand the followings:

  1. How to get access to LinkedIn Jobs API
  2. Install the python3-LinkedIn library for working with LinkedIn APIs
  3. Perform LinkedIn Developer Authentication
  4. Fetching a list of jobs.
  5. Getting job details
  6. Discover the limitations of LinkedIn Jobs API and more.

Getting Started

To get started, we first need to acquire an API secret key from LinkedIn. This is very easy to do! 😎. By following the steps below, you should be able to get your LinkedIn API credentials.

Visit the LinkedIn Developer web page

Image description

  1. Click on the create app

Image description

It’s Important you have a LinkedIn page associated with the app. In case you don’t have any page on your LinkedIn, don’t sweat it, you can create one by clicking on the Create a new LinkedIn page button below.

  1. Click on Auth and under the Application credentials card you will find your Authentication keys.

Image description

Easy isn’t it? 😀

Now, you have been able to acquire your API secret keys, next is to install necessary python libraries that will aid in this our operation.

Install the Python libraries

Run the code below on your terminal or command prompt to install the python3-linkedin library.

pip install python3-linkedin

The library can as well be downloaded and compiled using the following commands:

## First clone the repository
git clone https://github.com/DEKHTIARJonathan/python3-linkedin.git

## Then install the library
python setup.py install
Enter fullscreen mode Exit fullscreen mode

This library provides an interface to the LinkedIn Profile, Group, Company, Jobs, Search, Share, Network and Invitation REST APIs.

The LinkedIn REST API supports the OAuth 2.0 protocol for authentication.

Quick Usage From Python Interpreter

To quickly test the library using an python interpreter, you can do that comfortably from the test server.

from linkedin import server
application = server.quick_api(KEY, SECRET)
Enter fullscreen mode Exit fullscreen mode

This will print the authorization url to the screen. Go into that URL using a browser to grant access to the application. After you do so, the method will return with an API object you can now use.

Job Search API

The Job Search API enables search across LinkedIn’s job postings. You can get more information from here.

application.search_job(selectors=[{'jobs': ['id', 'customer-job-code', 'posting-date']}], params={'title': 'python', 'count': 2})
{u'jobs': {u'_count': 2,
  u'_start': 0,
  u'_total': 206747,
  u'values': [{u'customerJobCode': u'0006YT23WQ',
    u'id': 5174636,
    u'postingDate': {u'day': 21, u'month': 3, u'year': 2013}},
   {u'customerJobCode': u'00023CCVC2',
    u'id': 5174634,
    u'postingDate': {u'day': 21, u'month': 3, u'year': 2013}}]}}
Enter fullscreen mode Exit fullscreen mode

Jobs API

The Jobs APIs provide access to view jobs and job data.

application.get_job(job_id=5174636)
{u'active': True,
 u'company': {u'id': 2329, u'name': u'Schneider Electric'},
 u'descriptionSnippet': u"The Industrial Accounts Sales Manager is a quota carrying senior sales position principally responsible for generating new sales and growing company's share of wallet within the industrial business, contracting business and consulting engineering business. The primary objective is to build and establish strong and lasting relationships with technical teams and at executive level within specific in",
 u'id': 5174636,
 u'position': {u'title': u'Industrial Accounts Sales Manager'},
 u'postingTimestamp': 1363860033000}
Enter fullscreen mode Exit fullscreen mode

You can also fetch you job bookmarks.

application.get_job_bookmarks()
{u'_total': 0}
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
maximkacoder profile image
MaximkaCoder

Hello! Why am I getting such an error?
Error: The redirect_uri does not match the registered value