Failure of getSurvey() in the R API

Joe
Joe DC areaCommunity Member Qubie ✭

Hi

I have been using the R API successfully to pull my data in for statistical analysis and reporting. However, I have not used in about 3 months and when I came back to do this work I was unsuccessful. Here are my steps and error.

registerOptions(api_token=APIkey, root_url=baseURL)
surveys <- getSurveys()
surveys

This produces the list of surveys table shown in https://api.qualtrics.com/docs/response-exports

Survey Table in R

id name ownerId lastModified isActive
SV_0fHnuNimdt3R9pX Newer Name UR_123456789012345 2 017-05-25T22:15:22Z TRUE
SV_0zSlknmZXhJ4BAx TestFromURL UR_123456789012345 2 017-05-24T20:26:13Z FALSE
SV_0x1XmEv9pCD2asB Test UR_123456789012345 2 017-05-24T16:07:23Z FALSE
SV_3V7MgGcbG4YA3NH Test Survey 2 UR_123456789012345 2 017-05-24T21:10:21Z FALSE
SV_4SRzY5wAmUZSzkx TestFromUrl2 UR_123456789012345 2 017-05-24T21:07:15Z FALSE
SV_4VxakCgq7b1eU8B TestFromUrl2 UR_123456789012345 2 017-05-24T21:06:42Z FALSE
SV_5Ae4nEvcCXslEmR Simple UR_123456789012345 2 017-05-25T20:52:09Z FALSE
SV_5d16l4JrllvxLXf Second Project UR_123456789012345 2 017-05-18T19:49:31Z FALSE
SV_7TZNw44dHLLPRt3 TestFromURL UR_123456789012345 2 017-05-24T20:27:15Z FALSE
SV_9vTqLp3Yk8LofjL Timezone Test UR_123456789012345 2 017-06-09T19:29:58Z TRUE
SV_eVPWQKXxLplsOdP QuestionTypes UR_123456789012345 2 017-06-05T23:01:12Z TRUE

Then I use following syntax to pull the survey response data:

timezoneSurvey <- getSurvey(surveys$id[10])
or alternatively
timezoneSurvey <- getSurvey("SV_9vTqLp3Yk8LofjL")
or alternatively
timezoneSurvey <- getSurvey(surveys$id[10], force_request = TRUE)
or alternatively
timezoneSurvey <- getSurvey("SV_9vTqLp3Yk8LofjL", force_request = TRUE)

Please note that I have substituted the Survey Table and IDs from the aforementioned documentation instead of the Survey Table and IDs from our own account. I would rather not post these publicly, however, the syntax is is the same.

Please also note, that getSurveys() above is supposed to get a list of surveys, which is does as in the example above. getSurvey(), without the trailing 's' is supposed to get the survey data. Please scroll to the bottom of the documentation in:

https://api.qualtrics.com/docs/response-exports

Instead of getting the data, I receive the following error message:

Error in qualtRicsResponseCodes(res) :
Qualtrics API complains that the requested resource cannot be found (404 error). Please check if you are using the correct survey ID.

Finally note that this syntax was working a few months ago. So, it appears that a bug was introduced into the Qualtrics API for R.

Has anyone else encountered this problem and found a solution?

Tagged:

Comments

  • tmcmanus
    tmcmanus TorontoCommunity Member Qubie ✭

    Occasionally, I've found that qualtRics will throw that error when nothing is wrong, and that repeating the command will result in success. In my experience, 404s happen because of a hitch in the two stage response export process that getSurvey() is managing. If you haven't already, try running it again.

    Try other R x Qualtrics API packages like qualtricsR, https://github.com/jamesdunham/qsurvey, then if those don't work try opening up a jupyter notebook and following the python tutorial in the API documentation.

  • Joe
    Joe DC areaCommunity Member Qubie ✭

    Thanks tmcmanus.

    I of course tried it repeatedly, but am now trying it again a week or so later. But no luck. It is the same old message.

    I then tried qualtricsR and updated my R to the latest. qualtricsR does not work either. According to its github page (https://github.com/saberry/qualtricsR) to get survey data, you use:

    exportQualtricsData("username", "token", "idString", dropExtra = TRUE)

    however, when I do this, I receive the following error:

    Error in exportQualtricsData("myusername", "mytoken", :
    could not find function "exportQualtricsData"

    Of course, I have swapped out my true user name and token for security purposes in the above error message.

    So, still no luck!

    Thanks for your help.

    Joe

  • RTSullivan
    RTSullivan New Orleans, LACommunity Member, Qualtrics Brand Admin Guru ✭✭

    Strange, I use the package daily with various automated processes and I am not having any issues. Have you tried sending the requests through Postman or something to see if they work that way?

  • Joe
    Joe DC areaCommunity Member Qubie ✭

    Hi RTSullivan,

    I don't know what Postman is. But perhaps there is a more mundane explanation. I am running on Mac. Are you running on Windows or Linux?

    Joe

  • RTSullivan
    RTSullivan New Orleans, LACommunity Member, Qualtrics Brand Admin Guru ✭✭

    I am running on Windows. This question would be best answered by the package creator by filing an issue at https://github.com/JasperHG90/qualtRics/issues. JasperHG90 can help you troubleshoot your problem.