Making a "Get" request to the API for survey responses with Python | XM Community
Question

Making a "Get" request to the API for survey responses with Python

  • 18 December 2023
  • 0 replies
  • 369 views

Badge

Hi,

 

I’m very inexperienced with working with APIs. I’m trying to loop through multiple survey IDs and get survey responses through the API. I am doing this in Python.

 

I have managed to create csv files using the documentation here:

https://api.qualtrics.com/5e86e383167d5-getting-survey-responses-via-the-new-export-ap-is

However, this is not workable for my use case of looping through many surveys and efficiently pulling the response data into my Python session to perform further actions on. This also pulls in the whole dataset, when I only need a select few variables.

 

I tried using a get request along with json.loads hoping that this would include a json object with all the survey responses, but this didn’t seem to work. This worked for pulling the data for people on a mailing list, so thought it may be possible to do something similar.

 

I also tried the approach from the documentation to create csv files with just the variables I needed. I tried adding a ‘data = payload’ argument to the “POST” request, with payload including the following:

{"surveyMetadataIds" : "_recordId", "externalReference", "progress", "finished"}

which are the variables I need. I tried this based on the ‘Body’ section of this documentation:

https://api.qualtrics.com/6b00592b9c013-start-response-export

This did not work.

 

Essentially, I need an efficient way to pull those four variables from the API, looping through a long list of survey IDs, and preferrably into the session itself (e.g. as a dictionar(y/ies)) that I can then carry out further actions on.

 

Is this possible, and how would I go about this? Thanks in advance. Also, apologies if any of my tags are inaccurate.


0 replies

Be the first to reply!

Leave a Reply