Search code examples
pythonqualtrics

Python Qualtrics Data


So, I am pulling data from the Qualtrics v3 API, and would like to pull the data every night. How could I pull all of the data one night and come back the next night and pull all of the new data. There is a parameter that the survey responds with called "lastModified" which is the last modified date.

Here is an example call: import urllib.request #default module for Python 3.X

url = 'https://yourdatacenterid.qualtrics.com/API/v3/surveys'
header = {'X-API-TOKEN': ''}

req = urllib.request.Request(url,None,header) #generating the request object

handler = urllib.request.urlopen(req) #running the request object

print(handler.status) #print status code
print(handler.reason)

Here is an example of the JSON:

{
  "result": {
"elements": [
  {
    "id": "SV_0D54a3emdOh7bBH",
    "name": "Imported Survey",
    "ownerId": "UR_8CywXqaSNzzu1Bb",
    "lastModified": "2013-10-22T20:12:33Z",
    "isActive": true
  },
  ...
],
    "nextPage": "https://yourdatacenterid.qualtrics.com/API/v3/surveys?       offset=10"
  },
  "meta": {
    "httpStatus": "200 - OK"
  }
}

Solution

  • I think you want to use responseexports instead surveys. Save the last response id retrieved each day. Then, you can use the lastResponseId parameter to specify where to start pulling the new data.