Title: | Access to the LinkedIn API via R |
---|---|
Description: | A series of functions that allow users to access the 'LinkedIn' API to get information about connections, search for people and jobs, share updates with their network, and create group discussions. For more information about using the API please visit <https://developer.linkedin.com/>. |
Authors: | Michael Piccirilli <[email protected]> |
Maintainer: | Michael Piccirilli <[email protected]> |
License: | GPL-2 |
Version: | 0.2 |
Built: | 2024-08-21 06:07:09 UTC |
Source: | CRAN |
This is an R package that provides a series of functions that allow users to access the LinkedIn API to get information about connections, search for people, search for jobs, share updates with your network, and create group discussions.
Michael Piccirilli [email protected]
inOAuth
, getProfile
,
getMyConnections
, getGroupPosts
,
getGroups
, getJobs
,
searchJobs
, searchPeople
,
submitGroupPost
, submitShare
,
getCompany
, searchCompanies
getCompany
retrieves company profiles using a company Id, a universal name, or an email domain.
getCompany(token, universal_name = NULL, email_domain = NULL, company_id = NULL, partner = 0)
getCompany(token, universal_name = NULL, email_domain = NULL, company_id = NULL, partner = 0)
token |
Authorization token. |
universal_name |
LinkedIn universal company name. This is the exact name seen at the end of the URL on the company page on linkedin.com. |
email_domain |
The email domain used by the company. |
company_id |
LinkedIn company ID. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
The 'universal name' needs to be the exact name seen at the end of the URL on the company page on linkedin.com.
Returns company profile data, such as LinkedIn ID, name, universal-name, email-domains, company-type, ticker, website-url, industries, status, twitter handle, employee-count-range, specialties, locations, description, founded-year, and number of followers.
The output when specifying the universal_name
or company_id
will be in a list, whereas the output when specifying the email_domain
will be a dataframe.
Michael Piccirilli [email protected]
## Not run: company.name <- getCompany(token=in.auth, universal_name="Facebook") company.email <- getCompany(token=in.auth, email_domain = "columbia.edu") # Main Columbia Name: company.id <- getCompany(token=in.auth, company_id = company.email$company_id[14]) ## End(Not run)
## Not run: company.name <- getCompany(token=in.auth, universal_name="Facebook") company.email <- getCompany(token=in.auth, email_domain = "columbia.edu") # Main Columbia Name: company.id <- getCompany(token=in.auth, company_id = company.email$company_id[14]) ## End(Not run)
getGroupPosts
will retrieve posts from each LinkedIn group you belong to.
getGroupPosts(token, partner = 0)
getGroupPosts(token, partner = 0)
token |
Authorization token. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
Returns a dataframe with the 10 most recent posts from each group you belong to.
Michael Piccirilli [email protected]
## Not run: my.groups <- getGroupPosts(in.auth) ## End(Not run)
## Not run: my.groups <- getGroupPosts(in.auth) ## End(Not run)
getGroups
retrieves information and settings about the LinkedIn groups you belong to.
getGroups(token, details = FALSE, partner = 0)
getGroups(token, details = FALSE, partner = 0)
token |
Authorization token. |
details |
TRUE or FALSE. If TRUE, it will return group details. FALSE is default. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
This function returns information about what groups you belong to, either with or without group details. Group details can be called by setting the option details
= TRUE.
Returns a dataframe including group profile information.
When details
= FALSE (default), the function will return information about each group's settings such as whether it allows messages from members, email frequency, and manager announcements.
When details
= TRUE, the function will return both a short and long
description of the group.
Michael Piccirilli [email protected]
## Not run: my.groups <- getGroups(token = in.auth, details=TRUE) ## End(Not run)
## Not run: my.groups <- getGroups(token = in.auth, details=TRUE) ## End(Not run)
getJobs
can be used to retrieve your bookmarked and
suggested jobs.
getJobs(token, suggestions = NULL, bookmarks = NULL, partner = 0)
getJobs(token, suggestions = NULL, bookmarks = NULL, partner = 0)
token |
Authorization token. |
suggestions |
TRUE or FALSE. If TRUE, it will return LinkedIn's job recommendations. |
bookmarks |
TRUE or FALSE. If TRUE, it will return jobs you've bookmarked on LinkedIn. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
This function can return either jobs you've bookmarked on LinkedIn, or jobs LinkedIn is recommending for you, but not both at the same time.
Returns a dataframe of recommended or bookmarked jobs.
Michael Piccirilli [email protected]
## Not run: job.suggestions <- getJobs(in.auth, suggestions=TRUE) job.bookmarks <- getJobs(in.auth, bookmarks=TRUE) ## Will return NULL job.fail <- getJobs(in.auth) ## End(Not run)
## Not run: job.suggestions <- getJobs(in.auth, suggestions=TRUE) job.bookmarks <- getJobs(in.auth, bookmarks=TRUE) ## Will return NULL job.fail <- getJobs(in.auth) ## End(Not run)
getMyConnections
returns information about your 1st degree
connections who do not have their profile set to private.
You cannot "browse connections." That is, you cannot get connections of your connections (2nd degree connections).
getMyConnections(token, partner = 0)
getMyConnections(token, partner = 0)
token |
Authorization token. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
Returns a dataframe of your 1st degree LinkedIn connections.
Michael Piccirilli [email protected]
## Not run: my.connections <- getMyConnections(in.auth) ## End(Not run)
## Not run: my.connections <- getMyConnections(in.auth) ## End(Not run)
getProfile
retrieve's proflie information about to yourself, your connections, or another individual.
getProfile(token, connections = FALSE, id = NULL, partner = 0)
getProfile(token, connections = FALSE, id = NULL, partner = 0)
token |
Authorization token. |
connections |
TRUE or FALSE. If TRUE, will return profile information of your connections. FALSE is default. |
id |
Numeric ID number of a LinkedIn member. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
There are three separate calls in getProfile
.
The first is to return profile information about yourself. The only input
into the function under this scenario is the token
.
The second is to return profile information about all your 1st degree
connections. You need to supply the token
and set the
connections
= TRUE.
The third is to return profile information about an individual based on
their id number. This can be found if you search your connections using
the getMyConnections
function.
Returns a list of profile information.
Michael Piccirilli [email protected]
searchPeople
, getMyConnections
## Not run: profiles <- getProfile(in.auth, connections=TRUE) ## End(Not run)
## Not run: profiles <- getProfile(in.auth, connections=TRUE) ## End(Not run)
inOAuth
creates a long-lived OAuth access token that enables R to make
authenticated calls to the LinkedIn API. This function relies on the
httr
package to create the OAuth token.
inOAuth(application_name = NULL, consumer_key = NULL, consumer_secret = NULL)
inOAuth(application_name = NULL, consumer_key = NULL, consumer_secret = NULL)
application_name |
Name of your application. |
consumer_key |
Consumer API Key of your application. |
consumer_secret |
Consumer Secret Key of your application. |
There are two ways to create an authenticated connection. One is to use the default credentials supplied in the package. The second is to obtain your own credentials and using them as inputs into the function. Examples of both are shown below.
Create your own application here: https://developer.linkedin.com/
Authorization token to be used in other functions.
Michael Piccirilli [email protected]
## Not run: ## Default Consumer and Secret Key for the Rlinkedin package: in.auth <- inOAuth() ## Use your own Consumer and Secret Key: in.auth <- inOAuth("your_app_name", "your_consumer_key", "your_consumer_secret") ## End(Not run)
## Not run: ## Default Consumer and Secret Key for the Rlinkedin package: in.auth <- inOAuth() ## Use your own Consumer and Secret Key: in.auth <- inOAuth("your_app_name", "your_consumer_key", "your_consumer_secret") ## End(Not run)
searchCompanies
searches across LinkedIn's companies pages based on keywords, location, and industry.
searchCompanies(token, keywords, location = NULL, industry = NULL)
searchCompanies(token, keywords, location = NULL, industry = NULL)
token |
Authorization token. |
keywords |
A keyword used anywhere in a company's listing. Multiple words should be separated by a space. |
location |
LinkedIn geography code, found here: https://developer.linkedin.com/docs/reference/geography-codes. |
industry |
LinkedIn industry code, found here: https://developer.linkedin.com/docs/reference/industry-codes. |
In order to narrow the search down by location or industry, you must look up the proper input codes on the linkedin website. The geography codes can be found here: https://developer.linkedin.com/docs/reference/geography-codes, and the industry codes can be found here: https://developer.linkedin.com/docs/reference/industry-codes.
Returns a list, information includes company id, company name, universal name, website, twitter handle, employee count, founded date, number of followers, and company description.
Michael Piccirilli [email protected]
## Not run: search.comp <- searchCompanies(in.auth, keywords = "LinkedIn") ## End(Not run)
## Not run: search.comp <- searchCompanies(in.auth, keywords = "LinkedIn") ## End(Not run)
searchJobs
searches across LinkedIn's job postings.
There are several parameters that allow you to conduct either a broad or focused search.
In order to use this function, you must create your own appliction and apply for the Vetted API Access here: https://help.linkedin.com/app/ask/path/api-dvr. You cannot use the default credentials supplied in the Rlinkedin package.
searchJobs(token, keywords = NULL, company_name = NULL, job_title = NULL, country_code = NULL, postal_code = NULL, distance = NULL, partner = 0)
searchJobs(token, keywords = NULL, company_name = NULL, job_title = NULL, country_code = NULL, postal_code = NULL, distance = NULL, partner = 0)
token |
Authorization token. |
keywords |
A keyword used in the job title or description. Multiple words should be separated by a space. |
company_name |
Company posting the job. |
job_title |
Title of the job. |
country_code |
Specify the country in which to search. This is the ISO3166 country code, and must be in lower case. |
postal_code |
Must be combined with the |
distance |
Distance matches jobs within a distance from a central point. This is measured in miles and is best used in conjunction with both |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
There are many different search parameters that allow you to make a focused search of a particular job within a certain company some area of the country. Or you can search for all jobs posted based on general keywords.
Returns a dataframe of jobs based input parameters
Michael Piccirilli [email protected]
## Not run: search.results <- searchJobs(token = in.auth, keywords = "data scientist") ## End(Not run)
## Not run: search.results <- searchJobs(token = in.auth, keywords = "data scientist") ## End(Not run)
searchPeople
allows you to search for connections on LinkedIn. It returns most of what shows up when you do a search for people in the box at the top of the page on linkedin.com.
There are a number of parameters that allow you to conduct either a broad or focused search.
In order to use this function, you must create your own appliction and apply for the Vetted API Access here: https://help.linkedin.com/app/ask/path/api-dvr.
searchPeople(token, keywords = NULL, first_name = NULL, last_name = NULL, company_name = NULL, current_company = NULL, title = NULL, current_title = NULL, school_name = NULL, current_school = NULL, country_code = NULL, postal_code = NULL, distance = NULL, partner = 0)
searchPeople(token, keywords = NULL, first_name = NULL, last_name = NULL, company_name = NULL, current_company = NULL, title = NULL, current_title = NULL, school_name = NULL, current_school = NULL, country_code = NULL, postal_code = NULL, distance = NULL, partner = 0)
token |
Authorization token. |
keywords |
A keyword used in a person's profile. Multiple words should be separated by a space. |
first_name |
Search by a user's first name. |
last_name |
Search by a user's last name. |
company_name |
The name of a company where someone has as worked. |
current_company |
TRUE or FALSE, can only be used in conjunction with |
title |
A job title someone has held |
current_title |
TRUE or FALSE, can only be used in conjunction with |
school_name |
The name of a school someone has attended. |
current_school |
TRUE or FALSE, can only be used in conjuntion with |
country_code |
Specify the country in which to search. This is the ISO3166 country code, and must be in lower case. |
postal_code |
Must be combined with the |
distance |
Distance matches members within a distance from a central point. This is measured in miles and and is best used in conjunction with both |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
Returns a dataframe of people based input parameters
Michael Piccirilli [email protected]
## Not run: search.results <- searchPeople(token=in.auth, first_name="Michael", last_name="Piccirilli") ## End(Not run)
## Not run: search.results <- searchPeople(token=in.auth, first_name="Michael", last_name="Piccirilli") ## End(Not run)
submitGroupPost
will create a group discussion post in one of the
groups you belong to, specified by a Group Id.
submitGroupPost(token, group_id, disc_title = NULL, disc_summary = NULL, content_title = NULL, content_url = NULL, content_img = NULL, content_desc = NULL, partner = 0)
submitGroupPost(token, group_id, disc_title = NULL, disc_summary = NULL, content_title = NULL, content_url = NULL, content_img = NULL, content_desc = NULL, partner = 0)
token |
Authorization token. |
group_id |
Numeric Group ID. |
disc_title |
Group discussion title, required. |
disc_summary |
Group discussion summary, required. |
content_title |
Title for content, required. |
content_url |
Url for content, optional. |
content_img |
Url for an image, optional. |
content_desc |
Description of content, optional. |
partner |
Indicate whether you belong to the Partnership Program. Values: 0 or 1 |
You must include a minimum of a discussion title, discussion summary, and content title.
There are two possible responses to a successful submittal.
One, your post has been created and is visibile immediately. In this case you have most likely posted to an unmoderated group.
Two, your post has been accepted by the API but is pending approval by the group moderator, in which case you will not see your post until it has bene approved.
Michael Piccirilli [email protected]
## Not run: my.groups <- getGroups(in.auth) id <- my.groups$group_id[1] disc.title <- "Test connecting to the LinkedIn API via R" disc.summary <- "Im creating an R package to connect to the LinkedIn API, + this is a test post from R!" url <- "https://github.com/mpiccirilli" content.desc <- "Dev version of access to LinkedIn API via R. + Collaboration is welcomed!" submitGroupPost(in.auth, group_id=id, disc_title=disc.title, disc_summary=disc.summary, content_url=url, content_desc=content.desc) ## End(Not run)
## Not run: my.groups <- getGroups(in.auth) id <- my.groups$group_id[1] disc.title <- "Test connecting to the LinkedIn API via R" disc.summary <- "Im creating an R package to connect to the LinkedIn API, + this is a test post from R!" url <- "https://github.com/mpiccirilli" content.desc <- "Dev version of access to LinkedIn API via R. + Collaboration is welcomed!" submitGroupPost(in.auth, group_id=id, disc_title=disc.title, disc_summary=disc.summary, content_url=url, content_desc=content.desc) ## End(Not run)