The following API calls are currently available for the SurveyResponse object:
For info on returned fields and example returns go to SurveyResponse Sub-Object Returned Fields.
GET LIST - Get a list of all of your survey responses (excludes Deleted responses). View Example Return.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
page | page=3 | False |
resultsperpage | resultsperpage=100 | False |
filters | filter[field][0]=status&filter[operator][0]==&filter[value][0]=Complete | False |
GET SURVEYRESPONSE - Get information about a specified survey response. View Example Return.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse/121
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=12345&api_token_secret=12345 | True |
CREATE SURVEYRESPONSE - Create a new survey response. View Example Return.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?_method=PUT
While no specific data parameter is required, at least one data parameter must be passed in when creating/updating a response.
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
status | Complete, Partial, Disqualified | False |
data[ID][option SKU] (Populate a select question using ID) | data[1][10001]=Yes (Option title or Reporting value**) | False |
data[ID][value] (Populate an open-text question) | data[1][value]=Response text | False |
data[ID][option SKU-other] (Populate other text field) | data[1][10005-other]=Response text | False |
data[ID][comment] (Populate comment field) | data[1][comment]=Response text | False |
data[Shortname][option SKU] (Populate a select question using Shortname) | data[Shortname*][10001]=Yes (Option title or Reporting value**) | False |
data[Shortname][value] (Populate an open-text question using Shortname) | data[Shortname*][value=Response text] | False |
data[ID][option SKU-other] | data[1][10005-other]=Response text | False |
*Shortname is case sensitive
**When populating a response for a checkbox question, if the reporting value includes a comma it must be URL encoded.
UPDATE SURVEYRESPONSE - Update a specified survey response. View Example Return.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse/121?_method=POST
While no specific data parameter is required, at least one data parameter must be passed in when creating/updating a response.
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
status | Complete, Partial, Disqualified | False |
data[ID][option SKU] (Update a select question using ID) | data[1][10001]=Yes (Option title or Reporting value**) | False |
data[ID][value] (Update an open-text question) | data[1][value]=Response text | False |
data[ID][option SKU-other] (Update other text field) | data[1][10005-other]=Response text | False |
data[ID][comment] (Update comment field) | data[1][comment]=Response text | False |
data[Shortname][option SKU] (Update a select question using Shortname) | data[Shortname*][10001]=Yes (Option title or Reporting value**) | False |
data[Shortname][value] (Update an open-text question using Shortname) | data[Shortname*][value=Response text] | False |
*Shortname is case sensitive
**When populating a response for a checkbox question, if the reporting value includes a comma it must be URL encoded.
DELETE SURVEYRESPONSE - Delete a specified surveyresponse. View Example Return.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse/121?_method=DELETE
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
Filtering SurveyResponse Returns
When pulling surveyresponses it is fairly common to filter the responses that return. Below we cover filtering the surveyresponse object. Learn more about filtering other objects in our Filtering Tutorial.
Filtering can be used in conjunction with the GET method on the surveyresponse object. Filtering is not supported in the PUT, POST or DELETE methods.
Fields
Possible Fields | Example | Associated Objects |
---|---|---|
Question | [question(2)] | surveyresponse |
Question Option | [question(2), option(10001)] | surveyresponse |
URL Variable | [url("variablename")]* | surveyresponse |
Date Submitted (EST/EDT or GMT -5/GMT -4) | date_submitted | surveyresponse |
Is Test Data | is_test_data | surveyresponse |
Contact ID (v4 API only) | contact_id | surveyresponse |
Status | status | surveyresponse, survey, surveycampaign |
*URL Encode the square brackets and the double quotes.
Operators
Operation | Syntax | Requires a Value |
---|---|---|
Is Equal To | = | True |
Is Not Equal To | <> or != | True |
Less Than or Equal To | <= | True |
Greater Than or Equal To | >= | True |
Is Answered / Is Not Blank | IS NOT NULL | False |
Is Not Answered / Is Blank | IS NULL | False |
In Comma Separated List | in | True |
Filtering Examples
This query would return responses with question-id 2 answered yes.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?filter[field][0]=[question(2)]&filter[operator][0]==&filter[value][0]=yes
This query would return responses with submission times greater than or equal to 2011-02-23 13:23:28 and with the status of Complete.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?filter[field][0]=date_submitted&filter[operator][0]=>=&filter[value][0]=2011-02-23+13:23:28&filter[field][1]=status&filter[operator][1]==&filter[value][1]=Complete
Browsing Survey Responses
Returns default to 50 results for page. Use the page and resultsperpage parameters to customize your return for these calls.
Parameter | Example | Associated Objects |
---|---|---|
page | page=3 | surveyresponse, survey, surveycampaign, surveyquestion, surveypage, contact |
resultsperpage* | resultsperpage=100 (max=500) | surveyresponse, survey |
*Note: The limit for resultsperpage is 500 (subject to change), if set over the limit it will default back to the limit.
Browsing Examples
To view a different page of results use the page parameter. The below call would return results 101-150 as results are displayed 50 per page.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?page=3
To view more results per page use the resultsperpage parameter. The below call would return results 1-100.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?resultsperpage=100
Use the page and resultsperpage parameters in conjunction. This below call would return results 201-300.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?page=3&resultsperpage=100