qualtRics icon indicating copy to clipboard operation
qualtRics copied to clipboard

Error in `qualtrics_response_codes()` ... )

Open daaronr opened this issue 2 years ago • 2 comments

Same error others are getting, taking steps, not sure how to fix it. I censor all the possibly sensitive info in brackets or with 'XXX' below.

library(qualtRics)

qualtrics_api_credentials(api_key = "[Key here]", 
                          base_url = "[My organisation].qualtrics.com",
                          install = TRUE, 
  overwrite = TRUE)

readRenviron("~/.Renviron")

all_surveys() 

Lists surveys but throws warning message In check_for_warnings(cnt) : Request proxied. For faster response times, use this host instead: sjc1.qualtrics.com

Next I run

mysurvey <- fetch_survey(surveyID = "[Name of one of the surveys as listed in above command]", verbose = TRUE)

Throws:

Error in `qualtrics_response_codes()`:
! Qualtrics API raised a bad request (400) error - Please report this on
https://github.com/ropensci/qualtRics/issues
Run `rlang::last_error()` to see where the error occurred.

In terminal I check:

curl --request GET --url https://conjoint.co1.qualtrics.com/API/v3/whoami --header 'x-api-token: XXX'
{"result":{"brandId":"XXX","userId":"XXX","userName":"XXX","accountType":"XXX","firstName":"David","lastName":"XXX","email":"XXX","datacenter":"az1"},"meta":{"requestId":"XXX","httpStatus":"200 - OK","notice":"Request proxied. For faster response times, use this host instead: sjc1.qualtrics.com"}}$

where I censor all the possibly sensitive info in the above (replaced with 'XXX' or messages in brackets)

daaronr avatar Jul 25 '22 14:07 daaronr

base_url = [myorganization].sjc1.qualtrics.com solves this

daaronr avatar Jul 25 '22 15:07 daaronr

Yes, if you get a message about your request being proxied, you need to use the host they suggest. 👍 We have added this to the documentation here.

juliasilge avatar Jul 26 '22 01:07 juliasilge