Response Survey Counts | XM Community
Skip to main content

Does anyone know how I can pull just the total counts of responses for a survey via Python?

Hello @RyanMascarenhas  

I will assume you have an api set up for Python to pull from but it would essentially be this:

import requests

api_token = "YOUR_API_TOKEN" #most of this info is already located under the “Qualtrics ID” section in my acount
survey_id = "YOUR_SURVEY_ID"
base_url = "https://yourdatacenterid.qualtrics.com/API/v3/surveys/{}/export-responses".format(survey_id)

headers = {
    "X-API-TOKEN": api_token,
}

params = {
    "format": "json",  # Or a csv, whatever you prefer
}

response = requests.get(base_url, headers=headers, params=params)

if response.status_code == 200:
    response_data = response.json()
    # Process and work with the response data as needed
else:
    print("Error:", response.status_code)
 

I have done this in R studio a few times but this should be straight forward if you have it set up with the API connection. Here is also a video I used that I found on youtube that explains it very well (a little bit more complicated) 

 

 


Leave a Reply