-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API raised a bad request #255
Comments
I am having the same issue as described above! |
Are these related to #246? Are these shared surveys from another organization? |
No. This is my private account and the survey is not shared. I have since launched two other surveys with the same issue. Again, all_surveys() works fine. I just can't fetch. I've tried numerous configurations (e.g., force = TRUE, etc.). I get the same API error. Since I do not have this problem on my academic account, I'm wondering if it is a setting on Qualtrics. I could not find any options in my Admin panel. |
@LarryVincent Just checking here -- you are sure you purchased API access on your private (non-academic) account? For example, in your account section, you see this API section: Just also checking, you are using the API key/token from your personal account, not accidentally using the one from your academic account? |
Yes. I am able to generate a token and I am able to access my private account via API. |
OK, next thing to check -- do you get messages about your request being proxied? Like in #229 and #211? Another thing to try -- can you run this code to see a bit more detail about what is happening? ## put your survey ID here:
fetch_url <- qualtRics::generate_url(query = "fetchsurvey", surveyID = "SV_xxx")
raw_payload <- qualtRics:::create_raw_payload(
label = TRUE,
start_date = NULL,
end_date = NULL,
limit = NULL,
time_zone = NULL,
unanswer_recode = NULL,
unanswer_recode_multi = NULL,
include_display_order = TRUE,
include_questions = NULL,
breakout_sets = NULL
)
res <- qualtRics:::qualtrics_api_request("POST", url = fetch_url, body = raw_payload)
res$meta
#> $requestId
#> [1] "f52b2929-b24a-4c9d-88a6-e7c9d3ff660d"
#>
#> $httpStatus
#> [1] "200 - OK" Created on 2022-04-04 by the reprex package (v2.0.1) |
Hi!
I managed to solve my version of the issue - in my case, it was caused by
using a vector to select the variables I was importing. The vector
contained NA's, which caused the issue on my side. Might be a useful error
or check to add to the package?
…On Tue, Apr 5, 2022 at 6:37 AM Julia Silge ***@***.***> wrote:
OK, next thing to check -- do you get messages about your request being
proxied? Like in #229 <#229>
and #211 <#211>?
Another thing to try -- can you run this code to see a bit more detail
about what is happening?
## put your survey ID here:fetch_url <- qualtRics::generate_url(query = "fetchsurvey", surveyID = "SV_xxx")raw_payload <- qualtRics:::create_raw_payload(
label = TRUE,
start_date = NULL,
end_date = NULL,
limit = NULL,
time_zone = NULL,
unanswer_recode = NULL,
unanswer_recode_multi = NULL,
include_display_order = TRUE,
include_questions = NULL,
breakout_sets = NULL
)
res <- qualtRics:::qualtrics_api_request("POST", url = fetch_url, body = raw_payload)res$meta#> $requestId#> [1] "f52b2929-b24a-4c9d-88a6-e7c9d3ff660d"#> #> $httpStatus#> [1] "200 - OK"
Created on 2022-04-04 by the reprex package <https://reprex.tidyverse.org>
(v2.0.1)
—
Reply to this email directly, view it on GitHub
<#255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATPPXRFRXQQHANV2RPLNPXTVDMZHBANCNFSM5SKIITVA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I ran the code but received the same API error.
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.
res$meta
Error: object 'res' not found
I’ve reached out to Qualtrics to see if there is something wrong on my account.
… On Apr 4, 2022, at 11:37 AM, Julia Silge ***@***.***> wrote:
OK, next thing to check -- do you get messages about your request being proxied? Like in #229 <#229> and #211 <#211>?
Another thing to try -- can you run this code to see a bit more detail about what is happening?
## put your survey ID here:
fetch_url <- qualtRics::generate_url(query = "fetchsurvey", surveyID = "SV_xxx")
raw_payload <- qualtRics:::create_raw_payload(
label = TRUE,
start_date = NULL,
end_date = NULL,
limit = NULL,
time_zone = NULL,
unanswer_recode = NULL,
unanswer_recode_multi = NULL,
include_display_order = TRUE,
include_questions = NULL,
breakout_sets = NULL
)
res <- qualtRics:::qualtrics_api_request("POST", url = fetch_url, body = raw_payload)
res$meta
#> $requestId
#> [1] "f52b2929-b24a-4c9d-88a6-e7c9d3ff660d"
#>
#> $httpStatus
#> [1] "200 - OK"
Created on 2022-04-04 by the reprex package <https://reprex.tidyverse.org/> (v2.0.1)
—
Reply to this email directly, view it on GitHub <#255 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAD4UHM5XGJ2DJNR3QJA3QDVDMZHBANCNFSM5SKIITVA>.
You are receiving this because you were mentioned.
|
@LarryVincent You might want to try this as well to see if anything is weird in what you get back:
This would be called from the command line (not from R) and you would need to use your URL and your API token. |
It's very odd. I just spent an hour on the phone with Qualtrics to ensure there wasn't a permissions problem on the account. They say it's fully enabled and that the logs only show 200 requests, no 400 requests. I ran the code above and here are the (slightly redacted) results: {"result":{"brandId":"conclusive","userId":"-REDACTED-","userName":"-REDACTED-","accountType":"UT_BRANDADMIN","firstName":"Larry","lastName":"Vincent","email":"-REDACTED-","datacenter":"az1"},"meta":{"requestId":"9860c302-d1ae-4a5a-b059-5b6a3274f7b6","httpStatus":"200 - OK","notice":"Request proxied. For faster response times, use this host instead: sjc1.qualtrics.com"}}(base) |
Aaaaah OK @LarryVincent I think you have the "request proxied" problem that is the same as reported in #211 and #229!! Can you change your host to the host they recommend? |
That solved the problem! Thank you @juliasilge . This package is my lifeline and you're always quick to help us troubleshoot. Appreciate you! I have also logged this with Qualtrics API support team. Hopefully, it will be in their database for future challenges with others. |
I'm going to leave this issue and add a note in the vignette or something about this "request proxied" problem. |
@juliasilge I don't see which 'host they recommend there' Can you advise please? Thanks. Ah, you mean the one raised in the error message, got it! I.e., |
Have been using this package for a while with no issues. It works perfectly on my academic account and on an account for a client. But when I tried to fetch a survey with my consulting practice account I got an error message saying "Qualtrics API raised a bad request(400) error - Please report this message om ROpenSci."
I am able to use all_surveys() without issue, so it seems to be authenticating. I just can't fetch any surveys. Here's the command sent:
df <- fetch_survey(surveyID = SURVEY_ID,
force_request = TRUE)
Here's the trace:
<error/rlang_error>
Error in
qualtrics_response_codes()
:! Qualtrics API raised a bad request (400) error - Please report this on
https://github.com/ropensci/qualtRics/issues
Backtrace:
Run
rlang::last_trace()
to see the full context.The text was updated successfully, but these errors were encountered: