Limiting Survey API Data Extraction to Prior 10 Days | XM Community
Skip to main content
Hi,



We are successfully extracting our Qualtrics survey data using the API into a csv file. Question, how can we modify the API script such that only the prior 10 days are pulled? (It currently extracts all history) Also, we'd like to pass today's date into the title of the csv file that would only have the last 10 days of data. Is this possible?



Thanks,



Kevin
Please use below code:





Pass start date and end date and filtering to return only required results. The startDate parameter actually filters on Recorded Date rather than Start Date.

format: YYYY-MM-DD



# Step 1: Creating Data Export

downloadRequestUrl = baseUrl

downloadRequestPayload = '{"format":"' + fileFormat + '","startDate": "2019-01-01T00:00:00Z","endDate": "2019-01-05T13:36:24Z"}'

downloadRequestResponse = requests.request("POST", downloadRequestUrl, data=downloadRequestPayload, headers=headers)

progressId = downloadRequestResponse.json()["result"]["progressId"]

print(downloadRequestResponse.text)
For 10 days use



downloadRequestPayload = '{"format":"' + fileFormat + '","startDate": "2019-01-01T00:00:00Z","endDate": "2019-01-15T13:36:24Z"}'



It will give you data for Jan 1st till 15th

Leave a Reply