submitSurvey

Accepts responses to a single, active (published and not expired) survey and stores the responses, including creating or updating the constituent record if appropriate.

Client Servlet Server Servlet HTTP Methods Supported Requires Authentication
CRSurveyAPI None. POST Yes.

Client API Syntax

https://secure2.convio.net/organization/site/CRSurveyAPI?method=submitSurvey &api_key=value &v=value [ &auth=value ] [ &center_id=value ] [ &error_redirect=value ] [ &redirect=value ] [ &response_format=xml | json ] [ &sign_redirects=value ] [ &source=value ] [ &sub_source=value ] [ &success_redirect=value ] [ &suppress_response_codes=value ] &survey_id=value [ &auth=value ] [ &cons_birth_date=value ] [ &cons_city=value ] [ &cons_country=value ] [ &cons_county=value ] [ &cons_email=value ] [ &cons_email_format=value ] [ &cons_email_opt_in=value ] [ &cons_employer=value ] [ &cons_first_name=value ] [ &cons_gender=value ] [ &cons_last_name=value ] [ &cons_middle_name=value ] [ &cons_occupation=value ] [ &cons_password=value ] [ &cons_phone=value ] [ &cons_postal_opt_in=value ] [ &cons_prof_suffix=value ] [ &cons_rep_password=value ] [ &cons_state=value ] [ &cons_street1=value ] [ &cons_street2=value ] [ &cons_street3=value ] [ &cons_suffix=value ] [ &cons_title=value ] [ &cons_user_name=value ] [ &cons_zip_code=value ] [ &denyApiSubmit=value ] [ &question_=value ] [ &s_rememberMe=value ] [ &survey_cancel=value ] [ &auth=value ] [ &sso_auth_token=value ]

Usage Notes

Use this client-only method to submit a user's response to a single survey. To retrieve the survey, see the getSurvey method. Since this method can create and update constituent records it can only be used from trusted sources and requires an auth_token be passed in as the auth parameter.

Note: Only Active Surveys can be submitted to with this method, meaning a survey that is published and has not expired.
Note: Only Surveys the user has permission to view can be submitted to by this method.
Note: Only questions the user has permission to view will have their responses stored, even if you submit answers for other questions.
Note: See the "Implementation Tips" section of the getSurvey method for tips on handling Authentication Tokens, particularly if you get a "Method Not Allowed" error.

Submitting Responses To Questions

Submitting a response to a question is done by building a parameter using the question's ID and the prefix question_. For Example, to submit an answer of "test" to a question with the ID of 1002, you would use: "question_1002=test".

Note: The Hidden question types (Text, True/False, Interest Update) must still be submitted as part of this in order for the system to process the updates those questions represent.
Note: The question_ prefix is not used to submit responses to a Constituent Registration Information question. See the section below for handling those questions.

Constituent Registration Information (CRI) Questions

These questions are made up of multiple fields, and each field must be stored separately within Luminate Online. For this reason, each field within a CRI question has it's own parameter that you use to submit the response for that field.

The processing of responses to CRI questions through the survey is the same as the processing through the normal Survey application. The question's configuration determines whether to automatically log users in, how to handle cases where the user's responses match an existing constituent, etc.

Post-Submission Handling

Submitting a survey can login the user submitting the survey, you should refresh your auth token after submission.

This method will not automatically redirect to the URL specified in the Survey's configuration as the "Survey Submitted Page". The response will contain that URL as the nextUrl parameter if you do want to redirect the user there.

Note: If you submit a form directly to this method, the user cancelling the form will return a response where the "Survey Cancelled Page" is the nextUrl and the userCancelled is true.

The response also contains the Survey Thank You Page content that taking a survey directly (not through the API) would normally display. This is not a page that is possible to configure through the Luminate Online Admin Interface, nor is it something that can be linked to directly, but if you want to provide the same user-experience through the API as what the user would see when taking a survey not through the API, this is the thank you page content they would see if there is no "Survey Submitted Page" set for the survey.

A successful response to this method will also contain the user's responses to questions that they can provide a meaningful answer to. The response will contain an array of userResponses that contain the questionID, Question Text, and the responseValues that a user provided to that question. This will let you build a custom thank you page that can echo back to the user the answers that they provided, or create branching functionality based on their answers in the event of a successful submission.

Note: The User Responses only contains answers to which the user can provide "meaningful" answers. The questions that are not echoed back are:
  • Caption
  • Hidden Interest Update
  • Hidden Text Update
  • Hidden True/False Update
  • Captcha
Aside from Captcha questions, the user doesn't provide answers to the other questions, and the answer to a Captcha question is only meaningful in passing the Captcha challenge.
Note: The user responses will not contain the answers provided to a Constituent Registration Information question. If you would like to retrieve that data, you can use the getUser method to obtain the user's information.

Client API Parameters

Common Client Parameters

See topic Common Parameters.

survey_id

Required. The ID of the survey you are accessing.

Type xsd:nonNegativeInteger.

cons_birth_date

Optional. Parameter containing the value of the Birth Date field when submitting a survey containing a Constituent Registration Information Question, formatted per the ISO 8601 specification.

Type xsd:dateTime.

cons_city

Optional. Parameter containing the value of the City field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_country

Optional. Parameter containing the value of the Country field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_county

Optional. Parameter containing the value of the County field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_email

Optional. Parameter containing the value of the Email field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_email_format

Optional. Parameter containing the value of the Preferred Email Format field when submitting a survey containing a Constituent Registration Information Question. Default value if not provided is '0' indicating the user has no preferred format.

Type xsd:nonNegativeInteger.

Default is 0.

cons_email_opt_in

Optional. Parameter indicating the Email Opt In choice of a user when submitting a survey containing a Constituent Registration Information (CRI) Question. True indicates the constituent should be opted in, false indicates they should be opted out.

Type xsd:boolean.

cons_employer

Optional. Parameter containing the value of the Employer field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_first_name

Optional. Parameter containing the value of the First Name field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_gender

Optional. Parameter containing the value of the Gender field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_last_name

Optional. Parameter containing the value of the Last Name field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_middle_name

Optional. Parameter containing the value of the Middle Name field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_occupation

Optional. Parameter containing the value of the Occupation field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_password

Optional. Parameter containing the value of the Password field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_phone

Optional. Parameter containing the value of the Phone Number field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_postal_opt_in

Optional. Parameter indicating the Postal Mail Opt In choice of a user when submitting a survey containing a Constituent Registration Information (CRI) Question. True indicates the constituent should be opted in, false indicates they should be opted out.

Type xsd:boolean.

cons_prof_suffix

Optional. Parameter containing the value of the Professional Suffix field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_rep_password

Optional. Parameter containing the value of the Confirm / Re-enter Password field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_state

Optional. Parameter containing the value of the State field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_street1

Optional. Parameter containing the value of the Street 1 field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_street2

Optional. Parameter containing the value of the Street 2 field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_street3

Optional. Parameter containing the value of the Street 3 field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_suffix

Optional. Parameter containing the value of the Suffix field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_title

Optional. Parameter containing the value of the Title field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_user_name

Optional. Parameter containing the value of the User name field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

cons_zip_code

Optional. Parameter containing the value of the Zip / Postal Code field when submitting a survey containing a Constituent Registration Information Question.

Type xsd:string.

denyApiSubmit

Optional. Parameter indicating that the submission should NOT be accepted. This is a weak method of preventing scripts from submitting spam via your surveys by including a text input field that is hidden using Cascading Style Sheets (CSS). Do not use a hidden input field for this, as most spam-scripts do not auto-populate hidden inputs. If a script automatically fills in that field and submits the survey, the submission will not be processed. It is recommended that you provide a label indicating that humans should not fill in this field so that humans using a screen reader know to leave that field empty.

Type xsd:string.

question_

Optional. This parameter is not used by itself, but is used in conjunction with the Question's Id to create a Question Indicator Parameter. You must append a question's question Instance ID after the underscore, at which point this parameter indicates the answer to that question. Ex: 'question_1001=hello' would indicate that the question with the id 1001 is being submitted with an answer of 'hello'. When providing answers to a DateQuestion question, this parameter must be a date string formatted per the ISO 8601 specification. When providing answers to a NumericValue question this parameter must be a numeric value. For all other question types, this parameter is a string. Note: This type of Question Indicator Parameter is not used for Constituent Registration Information questions.

Type xsd:string.

s_rememberMe

Optional. Parameter indicating that the system should remember the user after logging them in (if the question is configured to log new users in).

Type xsd:boolean.

survey_cancel

Optional. Parameter indicating that user clicked the cancel/skip button. Submitting a value of 'true' indicates that the user has cancelled and the API will return a response indicating that the submission was successful and that the user cancelled. The response will include URL to redirect to based on the survey configuration (if any). Does not perform an automatic redirect.

Type xsd:boolean.

Default is false.

auth

Optional. You must provide either this parameter or the sso_auth_token parameter. If using this parameter, you must specify an auth token generated by an embedded [[S86]] session tag in a Convio web page.

sso_auth_token

Optional. You must provide either this parameter or the auth parameter. If using this parameter, you must specify a valid session authentication token returned by login, authenticateUser, or getSingleSignOnToken.

Response

See topic HTTP Status Codes.

XML response
<?xml version="1.0" encoding="UTF-8"?>
<submitSurveyResponse xsi:schemaLocation="http://convio.com/crm/v1.0 http://service.convio.net/xmlschema/crm.public.v1.xsd" xmlns="http://convio.com/crm/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <success>true</success>
  <userCanceled>false</userCanceled>
  <nextUrl xsi:nil="true"/>
  <thankYouPageContent><![CDATA[<div class="appArea"><p>Thank you for taking the Tell us A Little About You survey. Your input is very valuable to us in designing our program.</p><p>This organization often shares survey results with registered users. There are many benefits to being a registered user, and you can help us serve you more effectively by registering.</p><p><a href="http://yourdomain.org/site/ConsProfileUser">Click here to register and receive personalized content and email updates.</a></p></div><div class="appArea"><form action="http://yourdomain.org/site/PageServer" method="post"><p><input type="submit" name="go" id="go" value="Home" class="Button" /></p><input type="hidden" name="SURVEY_ID" id="SURVEY_ID" value="1001" /></form></div>]]></thankYouPageContent>
  <userResponses>
    <questionId>1001</questionId>
    <questionText>What is your favorite color?</questionText>
    <responseValue>Blue</responseValue>
  </userResponses>
  <userResponses>
    <questionId>1010</questionId>
    <questionText>When did you first visit our site?</questionText>
    <responseValue>Jan 10 2010</responseValue>
  </userResponses>
  <userResponses>
    <questionId>1010</questionId>
    <questionText>What types of content are you interested in?</questionText>
    <responseValue>1003</responseValue>
    <responseValue>1028</responseValue>
  </userResponses>
</submitSurveyResponse>

        
JSON response
{"submitSurveyResponse":{"thankYouPageContent":"<div class=\"appArea\"><p>Thank you for taking the Tell us A Little About You survey. Your input is very valuable to us in designing our program.<\/p><p>This organization often shares survey results with registered users. There are many benefits to being a registered user, and you can help us serve you more effectively by registering.<\/p><p><a href=\"http://yourdomain.org/site/ConsProfileUser\">Click here to register and receive personalized content and email updates.<\/a><\/p><\/div><div class=\"appArea\"><form action=\"http://yourdomain.org/site/PageServer\" method=\"post\"><p><input type=\"submit\" name=\"go\" id=\"go\" value=\"Home\" class=\"Button\" /><\/p><input type=\"hidden\" name=\"SURVEY_ID\" id=\"SURVEY_ID\" value=\"1001\" /><\/form><\/div>","nextUrl":null,"userCanceled":"false","userResponses":[{"questionId":"1001","questionText":"What is your favorite color?","responseValue":"Blue"},{"questionId":"1010","questionText":"When did you first visit our site?","responseValue":"Jan 10 2010"},{"questionId":"1010","questionText":"What types of content are you interested in?","responseValue":["1003","1028"]}],"success":"true"}}

        

Examples

The example is for a survey with an ID of 1024 and contains the following questions:

Question ID Question Type Question Text User's Response
1000 Constituent Registration Information Please provide your name and email: Kelly, Constituent, devnull+kconstituent@convio.com
1001 Short Text What is your favorite Color? Blue
1010 Numeric Value How many hours per week do you spend online (personal and business)? 40
1024 Hidden True/False Update Example Note: question is hidden, so there is no text TRUE
1030 Multiple Choice, Multiple Response What days do you use the internet the most? Wednesday, Friday

The following string should be submitted using a POST method:

    	https://demo-secure.convio.net/demo829/site/CRSurveyAPI?method=submitSurvey&v=1.0&api_key=MyAPIKey&survey_id=1024&question_1001=Blue&question_1010=40&question_1024=TRUE&question_1030=Wednesday&question_1030=Friday&cons_first_name=Kelly&cons_last_name=Constituent&cons_email=devnull+kconstituent@convio.com
    

Comments

Submitted by Chris at 07:44 AM on October 30, 2012
Is this still the correct endpoint? - https://secure2.convio.net/organization/site/CRSurveyAPI I get a 404 when using this address (replacing organization with my own).
Submitted by Brian at 12:34 PM on October 22, 2012
@brandrich: You don't have to be authenticated. It's just a poor choice for the term. It's really more of a session Id. You don't have to be logged in to be in a session.
Submitted by Anonymous at 11:09 AM on August 27, 2012
There is a thread or two in the community about the auth token issue. The auth token doesn't have to be associated with an authenticated user. Its really sort of a session token, which you can get anonymously using the S86 tag or the GetAuthToken method with the API.
Submitted by kennonb at 10:20 AM on May 9, 2012
Not sure if this is a bug or not, but the docs specify that you have to have a cons_id or member_id to get a SSO token. However, my tests show that you don't. Simply requesting a token via a server call, will supply you with a valid token... sans cons_id and member_id. Maybe this is their work-around for allowing new constituents to use the Survey API?
Submitted by @brandrich at 07:00 PM on January 11, 2012
What doesn't make sense here is that there is a required auth token that must be present before a survey can submitted. Doesn't this prevent 'new constituents' from completing a survey that hasn't previously registered?

Leave a Comment

Nickname
Comment
Enter this word: