mattroumaya / surveymonkey

Access your SurveyMonkey data directly from R!
https://mattroumaya.github.io/surveymonkey/
Other
42 stars 10 forks source link

Video tutorial? #88

Closed mhwangbo11 closed 2 years ago

mhwangbo11 commented 2 years ago

Greetings! Thanks for the amazing work/documentations. Do you happen to have a Youtube video tutorial on OAuth and how to navigate SurveyMonkey surveys? Thanks again for your amazing work!

mattroumaya commented 2 years ago

Hi @mhwangbo11! All credit goes to @sfirke and his team for creating such a great package.

There are no YouTube video tutorials for setting up your OAuth/API Token in your .rprofile, but I'd be happy to help you troubleshoot, or put together a step-by-step post.

Is there anything in particular that you're getting caught up with at the moment?

mhwangbo11 commented 2 years ago

Hi @mattroumaya Thanks again for your support! Here's where I am stuck. I use R Markdown HTML to code all our files, and I think I'm stuck with OAuth/API token set up section.

The error pops out Step 3 in below codes: Error code: Error in browse_surveys(10) : could not find function "browse_surveys"

I am assuming either Authentication process is not quite working or something is not quite right with my packages? What are your thoughts?

Here's how I wrote my code so far:

title: "SurveyMonkey_API_121021" author: "Min Hwangbo" date: "Last updated on r format(Sys.time(), '%B %d, %Y')" output:
html_document: preserve_yaml: true toc: true toc_float: true keep_md: true published: false

knitr::opts_chunk$set(echo = TRUE)

Skipping bunch of acknowledgement/reference sections

Step 1: Loading packages

library(devtools)

# After you call out devtools devtools::install_github("tntp/surveymonkey") on your console
## Common issue i.e. Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace β€˜cli’ 2.0.0 is already loaded, but >= 2.0.2 is required
### Common issue2 can be addressed by install.packages("cli") first before calling out devtools. Also make sure you have the most up-to-date Rtools4.

Step 2: Establishing API using your OAuth token

usethis::edit_r_profile() 

# Updated my OAuth SurveyMonkey by pasting `options(sm_oauth_token= "myAPI")`
## Then turn off/restarted R Studio

getOption("sm_oauth_token") # This worked 

Step 3: Let's browse your Survey Monkey

surveys <- browse_surveys(200) # see your most recent 200 surveys

Min

mattroumaya commented 2 years ago

Hi @mhwangbo11 - I think you just need to load the surveymonkey package.

For Step 1 above, include:

library(surveymonkey)
mhwangbo11 commented 2 years ago

It's working and one more error code pop up:

Error in browse_surveys(10) : Unauthorized (HTTP 401).

Thanks again @mattroumaya! Min

mattroumaya commented 2 years ago

When you log in to your SurveyMonkey app, does it say deployed? I have seen that cause a 401 error before.

Since a 401 error doesn't give us much to work with, I'm not too sure what else could be going on without barraging you with questions, so I'll hope that you just need to deploy the app and then it works! πŸ˜„

mhwangbo11 commented 2 years ago

Thanks again! @mattroumaya I found the issue! I think our org plan for API access is disabled (we'll need to purchase Premier account - it looks like we have a Team Advantage plan). Well thanks again at least this is a good start to figure out some more work in the future :)

mattroumaya commented 2 years ago

Ah yes, unfortunately you do need to have a Premier plan 😞. Glad you were able to figure out what went wrong, though!

mattroumaya commented 2 years ago

@mhwangbo11 - I did some investigating recently and it looks like limited API access is now available across all plans. If you have the chance to check it out at any point in the future, please feel free to report back and update if things are working for you!