Some users have requested an example call for creating a poll using the REST API. The below call creates a survey object with type=poll.
When creating a survey object with type=poll the polloptions array is required. In the below call we specified 2 answer options like so: &polloptions[0]=option 1&polloptions[1]=option 2.
In addition, we specified the theme=9405 which is the poll theme. Finally, with the optional parameter polltype, e.g. radio, image or ranking, can be specified.
https://restapi.surveygizmo.com/v4/survey.debug?_method=PUT&title=Poll&type=poll&theme=9405&polltype=ranking&polloptions[0]=option 01&polloptions[1]=option 2
.debug Formatted Return
Array
(
[result_ok] => 1
[data] => Array
(
[id] => 1358159
[team] => 406258
[_type] => Survey
[_subtype] => Poll
[status] => In Design
[created_on] => 2013-09-08 20:16:08
[modified_on] => 2013-09-08 20:16:08
[forward_only] =>
[languages] => Array
(
[0] => English
)
[title] => Poll
[internal_title] => Poll
[title_ml] => Array
(
[English] => Poll
)
[theme] => 9405
[blockby] =>
[statistics] =>
[embed] =>
[links] => Array
(
[edit] => {edit link}
[publish] => {publish link}
)
[pages] => Array
(
[0] => Array
(
[id] => 3
[_type] => SurveyPage
[title] => Array
(
[English] => Poll Question
)
[properties] => Array
(
[hidden] =>
)
[description] => Array
(
)
[questions] => Array
(
[0] => Array
(
[id] => 2
[_type] => SurveyQuestion
[_subtype] => rank
[title] => Array
(
[English] => Poll
)
[shortname] =>
[varname] =>
[description] => Array
(
)
[has_showhide_deps] =>
[comment] =>
[properties] => Array
(
[required] =>
[hidden] =>
[minimum_response] => 0
[option_sort] =>
[map_key] => rank-sort
[exclude_number] => YES
)
[options] => Array
(
[0] => Array
(
[id] => 10001
[_type] => SurveyOption
[title] => Array
(
[English] => option 1
)
[value] => option 1
[properties] =>
)
[1] => Array
(
[id] => 10002
[_type] => SurveyOption
[title] => Array
(
[English] => option 2
)
[value] => option 2
[properties] =>
)
)
[sub_question_skus] =>
)
)
)
[1] => Array
(
[id] => 4
[_type] => SurveyPage
[title] => Array
(
[English] => Results
)
[properties] => Array
(
[hidden] =>
)
[description] => Array
(
)
[questions] => Array
(
[0] => Array
(
[id] => 3
[_type] => SurveyDecorative
[_subtype] => instructions
[title] => Array
(
[English] => [survey("poll results")]
)
[shortname] =>
[varname] =>
[description] => Array
(
)
[has_showhide_deps] =>
[comment] =>
[properties] => Array
(
[hidden] =>
)
[options] => Array
(
)
[sub_question_skus] =>
)
)
)
)
)
)