Monday, 24 October 2016

Rlinkedin Package - Retrieving Linked profile Data Using Authorized API connection in R Program

Statement – Green
Coding – Red
Output - Blue

# setting the environment to work
>install_github("mpiccirilli/Rlinkedin")
Output:
Downloading GitHub repo mpiccirilli/Rlinkedin@master
from URL https://api.github.com/repos/mpiccirilli/Rlinkedin/zipball/master
Installing Rlinkedin
Installing 1 package: httr
Installing package into ‘C:/Users/ssn/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning: package ‘httr’ is in use and will not be installed
"C:/PROGRA~1/R/R-32~1.5/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/ssn/AppData/Local/Temp/RtmpQBDZwW/devtoolsd301a297018/mpiccirilli-Rlinkedin-4c96f7c"  \
  --library="C:/Users/ssn/Documents/R/win-library/3.2"  \
  --install-tests
* installing *source* package 'Rlinkedin' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (Rlinkedin)
Reloading installed Rlinkedin

# Install Rlinkedin package and run the package
>in.auth <- inOAuth()
Output
If you've created you're own application, be sure to copy and paste the following into
 'OAuth 2.0 Redirect URLs' in the LinkedIn Application Details: http://localhost:1410
 When done, press any key to continue...

#Connect to the LinkedIn API via oAuth 2.0. we have two way to connect in the Rlinkedin package.
Method 1 : for existing API setup
This will take you to the authorisation page, enter the LinkedIn password
https://www.linkedin.com/secure/developer
app_name <- "Dinesh"
consumer_key <- "XXXXXXX"
consumer_secret <- "XXXXXX"
in.auth <- inOAuth(app_name, consumer_key, consumer_secret)

#Retrieving my profile details
my.profile <- getProfile(in.auth)
my.profile

Output
[[1]]
[[1]]$connection_id
[1] "WdwO_qHP3Y"
[[1]]$fname
[1] "Dinesh"
[[1]]$lname
[1] "Kumar.v"
[[1]]$formatted_name
[1] "Dinesh Kumar.v"
[[1]]$location
[1] "India"
[[1]]$headline
[1] "Pursuing Post Graduation certification in Business Analytics"
[[1]]$industry
[1] "Information Technology and Services"
[[1]]$num_connections
[1] "134"
[[1]]$profile_url
[1] "https://www.linkedin.com/in/dinesh-kumar-v-466a6095"
[[1]]$num_positions
[1] 0
[[1]]$positions
[1] NA















1 comment:

  1. Thanks for sharing this coding. I would like to read more about r programming. Share more like this.
    Learn R Programming | R Training in Chennai

    ReplyDelete