Trouble Using the API to Get Survey Responses | XM Community
Solved

Trouble Using the API to Get Survey Responses


I'm attempting to use the Qualtrics API to get survey responses with Python (see https://api.qualtrics.com/docs/response-exports). I've basically copied the sample code verbatim, replacing it with my API Token, Survey ID, Data Center, etc. But when it gets to the step of downloading the file, in the following code, it fails.

Step 3: Downloading file


requestDownloadUrl = baseUrl + progressId + '/file'
requestDownload = requests.request("GET", requestDownloadUrl, headers=headers, stream=True)

This returns the following:

{
"meta":{
"httpStatus":"400 - Bad Request",
"error":{
"errorMessage":"Cannot download response export file through datacenter proxing, please retry using the url of the datacenter the API user belongs to: CO1",
"errorCode":"GRP_1"
},
"requestId":""
}
}

My data center is set correctly, so I'm confused about what could be causing this. Any ideas? Happy to provide my sample code, if that helps, but as I've said, it's pretty much an exact copy of what's in the documentation.

Thanks!
icon

Best answer by Matt_Christie_Walker 8 May 2018, 04:05

View original

9 replies

Userlevel 4
Badge +5
It seems Qualtrics does not agree that you are using the correct datacenter. If you are not using the right datacenter, it will proxy you (which is slower). In this case, that proxy seems to be failing as well.

Which datacenter are you using? What happens if you use CO1 ?

https://api.qualtrics.com/docs/root-url
I'm not sure what CO1 is--it's definitely not my data center, but I tried it on the very last API call and it corrected the problem. Seems odd that I'd use a different data center for that call than I've used throughout the code. Thanks!
Userlevel 4
Badge +5
Yeah, something still does not seem quite right to me either. I only guessed at CO1 because it's a data center I recognize, and because of the error message you posted.

Are you sure your other API calls are not being proxied? The link I posted before shows how to check.
The meaning of "Data Center ID" is very vague, specially in the documentation. I don't know of anyone who could correctly get the Data Center ID. I've sent several requests to Qualtrics to clarify this with no avail. It is somewhat frustrating to look at the documentation which is not valid or has incorrect information.
Userlevel 6
Badge +4
@Ben_Khosro1 Thanks for pointing this out to us! We think this is really important to clarify how to find the Datacenter ID, so we added it here.
I was able to get a response back of 'Download is 100.0 complete' after replacing the url with co1. However which folder does the downloaded file go to?
I was able to see the file under a new folder that it created in your local machine as MyQualtricsDownload. Thanks
Regarding the co1, its the datacenter within your organization . Hence you can replace the url with https://xxx.co1.qualtrics.com/ with xxx being your organizationID
Badge

I know it's been a while since this was posted about, but I am getting the same bizarre error message:

The operation failed with an error. [400] Cannot download response export file through datacenter proxing, please retry using the url of the datacenter the API user belongs to: co1.qualtrics.com

It's weird because 1) this data center doesn't exist anymore (supposedly) and has been replaced by iad1, 2) changing the data center from iad1 to co1 produces the same error, and 3) changing the data center from uci.co1... or uci.iad1... produces the same error.
(I'm a newbie on the API, and I'm trying to do a very simple thing -- just get automatic downloads of my data to a Google Drive -- and I'm at my wit's end with this stuff. Help. Save me.)

Leave a Reply