ropensci / qualtRics

Download ⬇️ Qualtrics survey data directly into R!
https://docs.ropensci.org/qualtRics
Other
215 stars 70 forks source link

Error in `qualtrics_response_codes()` when accessing collaborator's survey #292

Closed isaacahuvia closed 1 year ago

isaacahuvia commented 1 year ago

I am encountering a bad request (400) error in qualtrics_response_codes() when I try fetch_survey() for some, but not all, surveys associated with my account. I believe the issue has to do with the fact that some of the surveys in my account share the same base URL as my account, while surveys shared with me by certain collaborators do not. Specifically, this works:

qualtrics_api_credentials(
  api_key = [my key], 
  base_url = [my organization's base URL],
  overwrite = T,
  install = T
)

readRenviron("~/.Renviron")

fetch_survey([ID for survey with my organization's base URL])

But this does not:

qualtrics_api_credentials(
  api_key = [my key], 
  base_url = [my organization's base URL],
  overwrite = T,
  install = T
)

readRenviron("~/.Renviron")

fetch_survey([ID for survey with my collaborator's organization's base URL]) #Error 

I tried re-registering my credentials with the different base URL, but then neither worked:

qualtrics_api_credentials(
  api_key = [my key], 
  base_url = [my collarborator's organization's base URL],
  overwrite = T,
  install = T
)

readRenviron("~/.Renviron")

fetch_survey([ID for survey with my organization's base URL]) #Error
fetch_survey([ID for survey with my collaborator's organization's base URL]) #Error 

Does the Qualtrics API not allow me to access surveys shared by collaborators with different base URLs?

juliasilge commented 1 year ago

Yep unfortunately, if you want to access a survey via API from a given base URL, you need an API key for that account. A given API key only applies to the base URL it is created from. If you want to work with your collaborators' survey at a different account/base URL, you will need an API key from that account.

isaacahuvia commented 1 year ago

Got it, thanks!