Question
Get questions by template#
Returns a list of Question objects belonging to the given template.
Request parameters:
| Request Parameter | Type | Description | Required |
|---|---|---|---|
| onlyActive | Boolean | Only return non-deleted questions. Default true | false |
Examples
200 OK
Add new question to template#
Adds a new question to a template. Requires the
ROLE_SURVEY_ADMIN role.Request body:
| Attribute | Type | Description | Nullable |
|---|---|---|---|
| name | String | Question name | false |
| templateId | String | Identifier of the template | false |
| type | Object | Question type, see available types here | false |
| orderNum | Integer | Display order of the question within the template | true |
| calculated | Boolean | Whether the question's grade is calculated automatically | true |
| required | Boolean | Whether an answer is required | true |
| needComment | Boolean | Whether the user can leave a comment | true |
| commentRequired | Boolean | Whether the user is required to leave a comment | true |
| enableCustomAnswer | Boolean | Whether the user can add their own free-text answer | true |
| conditions | List objects | Makes the question visible only depending on the answer to another question. See Display conditions | true |
| hint | Object | Text/file Hint object shown with the question. Set separately via Add hint to question rather than on create | true |
Response
Returns the created Question object
Examples
200 OK
Update question#
Updates an existing question by id. Requires the
ROLE_SURVEY_ADMIN role.Request body:
| Attribute | Type | Description | Nullable |
|---|---|---|---|
| name | String | Question name | false |
| templateId | String | Identifier of the template | false |
| type | Object | Question type, see available types here | false |
| orderNum | Integer | Display order of the question within the template | true |
| calculated | Boolean | Whether the question's grade is calculated automatically | true |
| required | Boolean | Whether an answer is required | true |
| needComment | Boolean | Whether the user can leave a comment | true |
| commentRequired | Boolean | Whether the user is required to leave a comment | true |
| enableCustomAnswer | Boolean | Whether the user can add their own free-text answer | true |
| conditions | List objects | Makes the question visible only depending on the answer to another question. See Display conditions | true |
Response
Returns the updated Question object
Examples
200 OK
Add hint to question#
Adds a text and/or file hint to an existing question. Requires the
ROLE_SURVEY_ADMIN role.Request parameters:
| Request Parameter | Type | Description | Required |
|---|---|---|---|
| hint | String | Text hint | false |
Request body:
| Attribute | Type | Description | Nullable |
|---|---|---|---|
| file | MultipartFile | File hint(s), sent as multipart/form-data | true |
Response
Returns the Hint object
Examples
200 OK
Update hint#
Updates a question's hint โ sets/replaces the text, adds new files, and/or removes existing files by uid. Requires the
ROLE_SURVEY_ADMIN role.Request parameters:
| Request Parameter | Type | Description | Required |
|---|---|---|---|
| hint | String | Text hint | false |
| uidsForDelete | List of strings | Uids of previously uploaded hint files to remove | false |
Request body:
| Attribute | Type | Description | Nullable |
|---|---|---|---|
| file | MultipartFile | New file hint(s) to add, sent as multipart/form-data | true |
Response
Returns the updated Hint object
Examples
200 OK
Remove hint#
Removes the given files from a question's hint. Requires the
ROLE_SURVEY_ADMIN role.Request parameters:
| Request Parameter | Type | Description | Required |
|---|---|---|---|
| uids | List of strings | Uids of the hint files to remove | false |
Examples
200 OK
Get questions by instance#
Returns the template's questions for a specific form instance.
Request parameters:
| Request Parameter | Type | Description | Required |
|---|---|---|---|
| withAnswers | Boolean | Add the Answer object for each question | true |
Response
Returns a list of Question objects, each wrapped with
lastModified and (if withAnswers is true) an Answer objectExamples
200 OK