Running the Glassdoor API

John Muschelli

2018-11-21

Glassdoor API Keys

In order to use the glassdoor package, you need an API key from Glassdoor (either https://www.glassdoor.com/developer/register_input.htm or click Get API key from https://www.glassdoor.com/developer/index.htm).

After that is done, you need to set up the API keys. The keys are grabbed using

Sys.getenv("GLASSDOOR_PID")
Sys.getenv("GLASSDOOR_PAT")

so you can set these either using ~/.Renviron (will work generally) or your standard .profile or .bash_profile (if you work with command lines).

I recommend .Renviron as that works well with RStudio.

Calling the API

The function have_gd_tokens is a little wrapper that allows you to check if you have both API keys set.

For example, the below code will look for employers and search for pharmaceuticals within them.

library(glassdoor)
if (have_gd_tokens()) {
res = gd_api(
  action = "employers",
  other = NULL,
  version = 1,
  format = "json",
  q = "pharmaceuticals")
}

The function used here is gd_api which is the workhorse function of the package. Generally, however, you probably want to use gd_job_stats, gd_job_prog, or gd_company.

Job Statistics

Most of the defaults in gd_api do not need to be set, but the User-Agent defaults to

If you would like to change this, simply specify the agent argument in the glassdoor functions.

The job statistics specification can be found https://www.glassdoor.com/developer/jobsApiActions.htm#JobsStats.

## Warning in gd_api(version = "1.1", action = "jobs-stats", add_query =
## list(: Not Found (HTTP 404).
## NULL

Job Progression

The job statistics specification can be found https://www.glassdoor.com/developer/jobsApiActions.htm#JobProgression.

## [[1]]
## [[1]]$nextJobTitle
## [1] "cashier"
## 
## [[1]]$frequency
## [1] 2874
## 
## [[1]]$frequencyPercent
## [1] 18.788
## 
## [[1]]$nationalJobCount
## [1] 179534
## 
## [[1]]$medianSalary
## [1] 17220
## 
## 
## [[2]]
## [[2]]$nextJobTitle
## [1] "intern"
## 
## [[2]]$frequency
## [1] 1755
## 
## [[2]]$frequencyPercent
## [1] 11.47284
## 
## [[2]]$nationalJobCount
## [1] 13729
## 
## [[2]]$medianSalary
## [1] 40000

which gives the percentage of transitions to another profession after being a sales associate

Employers

You can also access information from employers from gd_company or the duplicate function gd_employer:

## $name
## [1] "Drew Houston"
## 
## $title
## [1] "Founder and CEO"
## 
## $numberOfRatings
## [1] 296
## 
## $pctApprove
## [1] 89
## 
## $pctDisapprove
## [1] 11
## 
## $image
## $image$src
## [1] "https://media.glassdoor.com/people/sqll/415350/dropbox-drew-houston.png"
## 
## $image$height
## [1] 200
## 
## $image$width
## [1] 200