ropensci / qualtRics

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

What was working how throws a 400 error #61

Closed Delkine closed 6 years ago

Delkine commented 6 years ago

This code has worked for quite a while but now throws a 400 error. Here is a snippet of the code where the error shows up.

surveys <- getSurveys()

---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------

lastid1.rds <-"R_2D5NheqdikcY0p2" ## Replace ResponseID with chosen ResponseID when it is known. lastid2.rds <-lastid1.rds

---------------------------------------------------------------------------------------------------------

mysurvey <- getSurvey(surveyID = surveys$id[9],

  • save_dir = "/users/del/dropbox/Polynesian_Cultural_Center/Shared_PCC/Qualtrics_Data/",
  • lastResponseId = lastid2.rds,
  • verbose=TRUE,
  • uselabels=FALSE,
  • force_request = TRUE) Error in qualtRicsResponseCodes(res, raw = raw) : Qualtrics API raised a bad request (400) error - Please report this on https://github.com/JasperHG90/qualtRics/issues
    -------------------------

Any suggestions?

Delkine commented 6 years ago

I found out that the reason this get survey call did not work was because the survey index code [9] in the statement: "mysurvey <- getSurvey(surveyID = surveys$id[9]" changed without us knowing about it. It changed from 9 to 8 and so the statements would not work correctly. Is it necessary to use this code instead of the actual survey id? I've tried using the actual survey id but I get an error. The survey index number can change depending on what other surveys are added or deleted. If this cannot be changed perhaps we could know the rules for assigning the code so we could anticipate what would cause the index number to change or better still provide a way to read the survey index from the surveys list and then read it into the code.

Bmanger commented 6 years ago

Hey @Delkine,

If you are still having this issue, you should be able to resolve it by directly pasting the surveyID in stringformat to the getSurvey command. If you prefer to reference the surveys object, you can try filtering it by survey name rather than row index. You could consider using: surveys$id[surveys$name == "YOURSURVEYNAME"]