The following API calls are currently available for the SurveyQuestion object:
GET LIST - Get a list of all of your survey questions.
https://api.alchemer.com/v5/survey/123456/surveyquestion
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
GET SURVEYQUESTION - Get information about a specified survey question.
https://api.alchemer.com/v5/survey/123456/surveyquestion/1
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
CREATE SURVEYQUESTION - Create a new survey question.
https://api.alchemer.com/v5/survey/123456/surveypage/1/surveyquestion?_method=PUT
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abc123&api_token_secret=abc123 | True |
surveypage | ID of page to add question to | True |
id† *This parameter must be used when adding sub-questions (ex. rows) to the following questions types: table-radio, table-checkbox, table-textbox, table-menu-matrix, table-stars, and group. | Question ID of the parent question | False |
type | radio, checkbox, menu, text, essay, email, multitext‡, single-image, multi-image, contsum, rank-dragdrop, table-radio, table-checkbox, table-textbox, table-menu-matrix, table-stars, file, instructions, media, audio, video, hidden, urlredirect, group, heatmap, texthighlighter, httpinsert, javascript | False |
title | Question text | False |
description | Description text | False |
after | Question ID to follow | False |
varname | SPSS Variable Name* | False |
shortname | Shortname/Alias | False |
Look & Feel Properties | Example | Required |
properties[disabled] | true | False |
properties[exclude_number] | true | False |
properties[hide_after_response] | true | False |
properties[option_sort] | ALPHA,NONE,SHUFFLE,true,false | False |
properties[orientation] | HORZ,VERT | False |
properties[labels_right] | true | False |
properties [question_description_above] | true | False |
properties[custom_css] | CSS template hook | False |
properties[placeholder][English]** | question placeholder text (open text questions) | False |
Validation Properties | Example | Required |
properties[required] | true | False |
properties[soft-required] | true | False |
properties[force_numeric] | true | False |
properties[force_percent] | true | False |
properties[force_currency] | true | False |
properties[subtype] | email, date | False |
properties[min_number] | value | False |
properties[max_number] | value | False |
properties[min_answers_per_row] | value | False |
properties[minimum_response] | value | False |
properties[inputmask][mask] | RegEx Pattern | False |
properties[inputmask][message] | RegEx Pattern | False |
properties[defaulttext] | Default text or reporting value | False |
Logic Properties | Example | Required |
properties[hidden] | true | False |
properties[piped_from] | Question ID to pipe from | False |
Continuous Sum Properties | Example | Required |
properties[max_total] | value | False |
properties[max_total_noshow] | true | False |
properties[must_be_max] | true | False |
File Upload Properties | Example | Required |
properties[maxfiles] | 1-10 | False |
properties[extentions] | png,gif,jpg,doc,xls,docx,xlsx,pdf,txt | False |
URL Redirect Properties | Example | Required |
properties[url] | Redirect URL | False |
properties[outbound][n][fieldname] | Variable Name | False |
properties[outbound][n][mapping] | Question ID for variable you wish to map | False |
properties[outbound][n][default] | Default Value to be passed when blank | False |
Heatmap Properties | Example | Required |
properties[heatmap_image] | https://url-of-your-image.jpg | False |
Text Highlighter Properties | Example | Required |
properties[messages][th_content][English] | This%20is%20the%20text%20to%20highlighter | False |
Http Insert Properties | Example | Required |
properties[data_type] | response,fields (fields must be configured via the UI) | True |
properties[url] | http%3A%2F%2Fwww.demo.testom%2Fwebhook.php | True |
properties[data_json] | true (only works when properties[data_type] is set to "response" | False |
Audio & Video Element Properties | Example | Required |
properties[aurl] | url of audio/video content formatted as //www.example.com | True |
properties[http] | http,https (defaults to http if invalid value is passed) | True |
Dropdown Menu Grid Properties | Example | Required |
properties[limits][] | array of dropdown menu answer options, ex. properties[limits][]=apple&properties[limits][]=orange | True |
Action Properties | Example | Required |
properties[javascript_code] | Base64-encoded JavaScript code. ex: YWxlcnQoIkhlbGxvISBJIGFtIGFuIGFsZXJ0IGJveCEhIik7 | False |
Properties[Option_sort] parameter sorting behavior definitions :
- ALPHA: alphabetical sort on values created.
- NONE: Original order when the question was created.
- SHUFFLE: Randomized order of question value created.
- true: alphabetized sort of values created.
- false: leave original order of values created.
†This parameter must be used when adding sub-questions (ex. rows) to the following questions types: table-radio, table-checkbox, table-textbox, table-menu-matrix, table-stars, and group.
‡Use to create rows of a Dropdown Menu Grid
*For question types with multiple fields this must be specified as an array with the option ID as the key. For example, the follow call is used to specify the SPSS variable names for each row of a Textbox List question.
https://api.alchemer.com/v4/survey/2120303/surveypage/12/surveyquestion/23.debug?_method=POST&varname[10001]=Comedy&varname[10002]=Drama&varname[10003]=Foreign&varname[10004]=Western
**Required parameter - language version of the placeholder text must be specified.
UPDATE SURVEYQUESTION - Update a specified surveyquestion.
https://api.alchemer.com/v5/survey/123456/surveyquestion/1?_method=POST
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
title | Question text | False |
description | Description text | False |
varname | SPSS Variable Name* | False |
shortname | Shortname/Alias | False |
Look & Feel Properties | Example | Required |
properties[disabled] | true | False |
properties[exclude_number] | true | False |
properties[hide_after_response] | true | False |
properties[option_sort] | ALPHA,NONE,SHUFFLE,true,false | False |
properties[orientation] | HORZ,VERT | False |
properties[labels_right] | true | False |
properties[question_description_above] | true | False |
properties[custom_css] | CSS template hook | False |
properties[placeholder][English]** | question placeholder text (open text questions) | False |
Validation Properties | Example | Required |
properties[required] | true | False |
properties[soft-required] | true | False |
properties[force_numeric] | true | False |
properties[force_percent] | true | False |
properties[force_currency] | true | False |
properties[min_number] | value | False |
properties[max_number] | value | False |
properties[min_answers_per_row] | value | False |
properties[minimum_response] | value | False |
properties[inputmask] | RegEx Pattern | False |
properties[defaulttext] | Default text or reporting value | False |
Logic Properties | Example | Required |
properties[hidden] | true | False |
properties[piped_from] | Question ID to pipe from | False |
Continuous Sum Properties | Example | Required |
properties[max_total] | value | False |
properties[max_total_noshow] | true | False |
properties[must_be_max] | true | False |
File Upload Properties | Example | Required |
properties[maxfiles] | 1-10 | False |
properties[extentions] | png,gif,jpg,doc,xls,docx,xlsx,pdf,txt | False |
URL Redirect Properties | Example | Required |
properties[url] | Redirect URL | False |
properties[outbound][n][fieldname] | Variable Name | False |
properties[outbound][n][mapping] | Question ID for variable you wish to map or url if mapping from a URL variable | False |
properties[outbound][n][url] | The name of the URL variable mapped from, if mapping from a URL variable | |
properties[outbound][n][default] | Default Value to be passed when blank | False |
Heatmap Properties | Example | Required |
properties[heatmap_image] | https://url-of-your-image | True |
Text Highlighter Properties | Example | Required |
properties[messages][th_content][English] | This%20is%20the%20text%20to%20highlighter | False |
Http Insert Properties | Example | Required |
properties[data_type] | response,fields (fields must be configured via the UI) | True |
properties[url] | http%3A%2F%2Fwww.demo.testom%2Fwebhook.php | True |
Audio & Video Element Properties | Example | Required |
properties[aurl] | url of audio/video content formatted as //www.example.com | True |
properties[http] | http,https (defaults to http if invalid value is passed) | True |
Dropdown Menu Grid Properties | Example | Required |
properties[limits][] | array of dropdown menu answer options, ex. properties[limits][]=apple&properties[limits][]=orange | True |
Action Properties | Example | Required |
properties[javascript_code] | Base64-encoded JavaScript code. ex: YWxlcnQoIkhlbGxvISBJIGFtIGFuIGFsZXJ0IGJveCEhIik7 | False |
*For question types with multiple fields this must be specified as an array with the option ID as the key. For example, the follow call is used to specify the SPSS variable names for each row of a Textbox List question.
https://api.alchemer.com/v4/survey/2120303/surveypage/12/surveyquestion/23.debug?_method=POST&varname[10001]=Comedy&varname[10002]=Drama&varname[10003]=Foreign&varname[10004]=Western
**Required parameter - language version of the placeholder text must be specified.
DELETE SURVEYQUESTION - Delete a specified survey question.
https://api.alchemer.com/v5/survey/123456/surveyquestion/1?_method=DELETE
Parameters | Example | Required |
---|---|---|
Authentication Credentials | api_token=abcd12345&api_token_secret=abcd12345 | True |
Creating a Grid Question with the API
- Create the parent question with one of the grid question types (table-radio, table-checkbox, table-textbox, table-menu-matrix). After doing this, note the question ID of this question, this is the parent question.
- Create the columns of the grid by adding a 'surveyoption' for each column using the CREATE SURVEYOPTION.
- Create the rows by creating questions of the appropriate type and include 'id' parameter. The id is the question id of the parent question created in step 1.