You can always download your survey data as a CSV, SPSS, XML or HTML file under the “View Results” tab of your Qualtrics survey dashboard. However, sometimes it is useful to read your data directly in to SAS. For example, if you would like to do a recurring analysis of your data in SAS, you would not have to keep downloading the updated data file as people continue taking your survey.
Qualtrics REST API
The Qualtrics REST Application Programming Interface (API) allows you to query our system using simple URL syntax without having to log in to the regular Qualtrics interface. The API is typically used to set up an automated system, such as automatically downloading a survey's data at midnight each night, or each day automatically scheduling a mailing to a list of respondents from a CRM, etc. API access typically incurs an extra cost. If you don’t have API access, but someone in your organization does, you can collaborate your survey with that person to be able to use the API. Contact a Qualtrics representative for more information about acquiring API access.
The root URL for communicating with the Qualtrics system is:
https://new.qualtrics.com/Server/RestApi.php. If you do not specifically need the data to come from a secure http location, you can simply use “http” instead of “https”. Otherwise, you must download the SAS/SECURE™ SSL Add-in module and obtain an SSL certificate. The add-in can be found at SAS/Secure Software. An explanation on how to obtain an SSL certificate can be found here.
Survey Request: getResponseData
In order to use the API to get your survey data, you will need to use the getResponseData request. The required parameters for this request are User, Password, SurveyID, and Format.
Example:
https://new.qualtrics.com/Server/RestApi.php?Request=getResponseData&User=MyUserName&Password=MyPassword&SurveyID=SV_123456789&Format=XML
User and Password are simply your Qualtrics username and password. Your SurveyID can be found by logging in to your Qualtrics account and clicking on your survey. The survey ID will be displayed in the URL and will begin with “SV_”. The Format parameter specifies the format you want your downloaded data to be in. A table of all possible parameters for the getResponseData request is provided below.
| Parameter |
Value(s) / Formatting |
Required |
Description |
| User |
String |
Yes |
Qualtrics username |
| Password |
String |
Yes |
Qualtrics password |
| SurveyID |
String |
Yes |
The survey you will be getting the responses for. |
| Format |
{XML, CSV} |
Yes |
The format the data will be transmitted in. |
| ResponseID |
String |
No |
The response id of an individual response. ResponseSetID, SubgroupID, StartDate, and EndDate should not be specified when using this parameter. |
| ResponseSetID |
String |
No |
The response set you want to retrieve the data from. If not specified it will use the default response set. |
| SubgroupID |
String |
No |
The subgroup you want to download the data for. |
| StartDate |
YYYY-MM-DD |
No |
The date the responses must be after. YYYY-MM-DD HH:MM:SS |
| EndDate |
YYYY-MM-DD |
No |
The date the responses must be before. YYYY-MM-DD HH:MM:SS |
| Questions |
Comma-separated list of question ids |
No |
Will filter the data to only include those specific questions. |
| Labels |
{0,1} |
No |
If 1 (true), the label for choices and answers will be used and not the id. The default is 0. |
| ExportTags |
{0,1} |
No |
If 1 (true), the export tags will be used rather than the V labels. The default is 0. |
| ExportQuestionIDs |
{0,1} |
No |
If 1 (true), the internal question IDs will be used rather than export tags or the V labels. The default is 0. |
| ExportRowID |
{0,1} |
No |
If 1 (true), the row id will be exported. The default is 0. |
| LastRowID |
Integer |
No |
Each response is recorded sequentially. The row id is incremented for each new response. When specified it will export all responses after the id specified. |
| LocalTime |
{0,1} |
No |
If 1 (true), the StartDate and EndDate will be exported using the specified user's local time zone. The default is 0 {false} which uses the server time zone. |
| UnansweredRecode |
Integer |
No |
The recode value for seen but unanswered questions. If not specified a blank value is put in for these questions. |
| PanelID |
String |
No |
If supplied, it will only get the results for members of that specific panel. |
| Limit |
Integer |
No |
The maximum number of responses to return. |
| IncludeStatus |
{0,1} |
No |
If 1 (true), the response status data will be included. The default is 1. |
SAS
The following example uses macros to assign values to the required parameters of the getResponseData request. These macros are then used in the filename statement where the full URL is assigned the name “mySurvey”. The data step assigns the name “SurveySample” to the data found at the specified URL and inputs the variable names.
Example:
/*These Macros assign values to the required parameters of the getResponseData request. Replace the values on the right of the equals sign with your own values.*/
%let myUserName = John;
%let myPassword = password;
%let mySurveyID = SV_123456789;
%let myFormat = CSV;
/*Full URL*/
filename mySurvey url "http://new.qualtrics.com/Server/RestApi.php?Request=getResponseData&User=&myUserName&Password=&myPassword&SurveyID=&mySurveyID&Format=&myFormat" debug;
/*Data Step*/
data SurveySample;
infile mySurvey firstobs=3 dsd length=len; *firstobs makes SAS begin reading in the data at row 3. Your data may start at a different line depending on the settings you have in your Qualtrics account;¬
input ResponseID :$15. ResponseSet :$7. Name :$9. ExternalData $12. EmailAddress :$15. IPAddress :$30. Status $ StartDate :$30. EndDate :$30. Finished
Question1
Question2
Question3; *this step assigns variable names to the collected information in your survey;
run;
In this example, SurveySample contains the results for only 3 questions from the survey. The rest of the variables are columns that Qualtrics surveys usually automatically output. Following is a description of each of these columns.
- ResponseID – a randomly generated code for each participantResponseSet – this might not appear in each data set, depending on the settings you have in your Qualtrics account.
- Name – name of the respondent. It may be anonymous depending on the specifications you have for your Qualtrics survey.
- ExternalData – can be used if you want to associate an ID with each panel member with an ID outside of the Qualtrics system. For more information, refer to Qualtrics University.
- EmailAddress – email address of the respondent.
- IPAddress – the IP address of the computer the survey was taken on.
- Status – this is used as an identifier for spam responses. For more information, refer to Qualtrics University.
- StartDate – the date that the participant started taking the survey.
- EndDate – the date that the participant finished taking the surveyFinished – a “1” in this column indicates that the participant finished the survey.