Skip to main content

Question

Get questions by template#

Returns a list of Question objects belonging to the given template.

Request parameters:

Request ParameterTypeDescriptionRequired
onlyActiveBooleanOnly return non-deleted questions. Default truefalse

Examples

curl https://api.qvalon.com/v1/survey/questions/608131be7eb7af765469e6a4 \
--header 'Authorization: Bearer <your_token>'
200 OK
[
{
"id": "6082b4e67eb7af765469e732",
"templateId": "608131be7eb7af765469e6a4",
"deleted": false,
"name": "Choose a number",
"type": {
"typeName": "NUMBER",
"grades": [],
"multiple": false,
"possibleAnswers": []
},
"conditions": [],
"calculated": false,
"required": false,
"orderNum": 11,
"updateAt": "2024-05-23T11:52:06.053325",
"needComment": false,
"commentRequired": false,
"enableCustomAnswer": false
}
]

Add new question to template#

Adds a new question to a template. Requires the ROLE_SURVEY_ADMIN role.

Request body:

AttributeTypeDescriptionNullable
nameStringQuestion namefalse
templateIdStringIdentifier of the templatefalse
typeObjectQuestion type, see available types herefalse
orderNumIntegerDisplay order of the question within the templatetrue
calculatedBooleanWhether the question's grade is calculated automaticallytrue
requiredBooleanWhether an answer is requiredtrue
needCommentBooleanWhether the user can leave a commenttrue
commentRequiredBooleanWhether the user is required to leave a commenttrue
enableCustomAnswerBooleanWhether the user can add their own free-text answertrue
conditionsList objectsMakes the question visible only depending on the answer to another question. See Display conditionstrue
hintObjectText/file Hint object shown with the question. Set separately via Add hint to question rather than on createtrue

Response

Returns the created Question object

Examples

curl --request POST https://api.qvalon.com/v1/survey/questions \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"name":"Choose a number","type":{"typeName":"NUMBER","multiple":false,"possibleAnswers":[]},"calculated":false,"required":false,"needComment":false,"commentRequired":false,"enableCustomAnswer":false,"conditions":[],"orderNum":11,"templateId":"608131be7eb7af765469e6a4"}'
200 OK
{
"id": "6082b4e67eb7af765469e732",
"templateId": "608131be7eb7af765469e6a4",
"deleted": false,
"name": "Choose a number",
"type": {
"typeName": "NUMBER",
"grades": [],
"multiple": false,
"possibleAnswers": []
},
"conditions": [],
"calculated": false,
"required": false,
"orderNum": 11,
"updateAt": "2024-05-23T11:52:06.053325",
"needComment": false,
"commentRequired": false,
"enableCustomAnswer": false
}

Update question#

Updates an existing question by id. Requires the ROLE_SURVEY_ADMIN role.

Request body:

AttributeTypeDescriptionNullable
nameStringQuestion namefalse
templateIdStringIdentifier of the templatefalse
typeObjectQuestion type, see available types herefalse
orderNumIntegerDisplay order of the question within the templatetrue
calculatedBooleanWhether the question's grade is calculated automaticallytrue
requiredBooleanWhether an answer is requiredtrue
needCommentBooleanWhether the user can leave a commenttrue
commentRequiredBooleanWhether the user is required to leave a commenttrue
enableCustomAnswerBooleanWhether the user can add their own free-text answertrue
conditionsList objectsMakes the question visible only depending on the answer to another question. See Display conditionstrue

Response

Returns the updated Question object

Examples

curl --request PUT https://api.qvalon.com/v1/survey/questions/6082b4e67eb7af765469e732 \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"name":"Choose a number (1-5)","type":{"typeName":"NUMBER","multiple":false,"possibleAnswers":[]},"calculated":false,"required":true,"needComment":false,"commentRequired":false,"enableCustomAnswer":false,"conditions":[],"orderNum":11,"templateId":"608131be7eb7af765469e6a4"}'
200 OK
{
"id": "6082b4e67eb7af765469e732",
"templateId": "608131be7eb7af765469e6a4",
"deleted": false,
"name": "Choose a number (1-5)",
"type": {
"typeName": "NUMBER",
"grades": [],
"multiple": false,
"possibleAnswers": []
},
"conditions": [],
"calculated": false,
"required": true,
"orderNum": 11,
"updateAt": "2024-05-23T11:52:06.053325",
"needComment": false,
"commentRequired": false,
"enableCustomAnswer": false
}

Add hint to question#

Adds a text and/or file hint to an existing question. Requires the ROLE_SURVEY_ADMIN role.

Request parameters:

Request ParameterTypeDescriptionRequired
hintStringText hintfalse

Request body:

AttributeTypeDescriptionNullable
fileMultipartFileFile hint(s), sent as multipart/form-datatrue

Response

Returns the Hint object

Examples

curl --request POST https://api.qvalon.com/v1/survey/questions/6082b4e67eb7af765469e732/hint?hint=Take a photo of the whole shelf \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"textHint": "Take a photo of the whole shelf",
"urlHint": [
{
"name": "example.png",
"uid": "a892f3e8-322d-4311-a31a-2bffa2295afe",
"url": "/files/s1/a/8/a892f3e8-322d-4311-a31a-2bffa2295afe.png",
"size": 94232,
"contentType": "image/png"
}
]
}

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 ParameterTypeDescriptionRequired
hintStringText hintfalse
uidsForDeleteList of stringsUids of previously uploaded hint files to removefalse

Request body:

AttributeTypeDescriptionNullable
fileMultipartFileNew file hint(s) to add, sent as multipart/form-datatrue

Response

Returns the updated Hint object

Examples

curl --request PUT https://api.qvalon.com/v1/survey/questions/6082b4e67eb7af765469e732/hint?hint=Take a wide-angle photo of the whole shelf \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"textHint": "Take a wide-angle photo of the whole shelf",
"urlHint": [
{
"name": "example.png",
"uid": "a892f3e8-322d-4311-a31a-2bffa2295afe",
"url": "/files/s1/a/8/a892f3e8-322d-4311-a31a-2bffa2295afe.png",
"size": 94232,
"contentType": "image/png"
}
]
}

Remove hint#

Removes the given files from a question's hint. Requires the ROLE_SURVEY_ADMIN role.

Request parameters:

Request ParameterTypeDescriptionRequired
uidsList of stringsUids of the hint files to removefalse

Examples

curl --request DELETE https://api.qvalon.com/v1/survey/questions/id}/hint/{hintId?uids=a892f3e8-322d-4311-a31a-2bffa2295afe \
--header 'Authorization: Bearer <your_token>'
200 OK
{}

Get questions by instance#

Returns the template's questions for a specific form instance.

Request parameters:

Request ParameterTypeDescriptionRequired
withAnswersBooleanAdd the Answer object for each questiontrue

Response

Returns a list of Question objects, each wrapped with lastModified and (if withAnswers is true) an Answer object

Examples

curl https://api.qvalon.com/v1/survey/questions/instance/6082cc827eb7af765469e736?withAnswers=true \
--header 'Authorization: Bearer <your_token>'
200 OK
[
{
"question": {
"id": "6080093d6ff4fb63493e3123",
"templateId": "606ac4f65b784e60cb88cb5b",
"originalId": "608008536ff4fb63493e3120",
"deleted": false,
"name": "Choose a number",
"type": {
"typeName": "NUMBER",
"grades": [],
"multiple": false,
"possibleAnswers": []
},
"conditions": [],
"calculated": false,
"required": true,
"orderNum": 0,
"updateAt": "2024-05-21T11:15:09.411",
"needComment": true,
"commentRequired": false,
"enableCustomAnswer": false
},
"lastModified": "2024-05-23T13:33:22.555",
"answers": {
"id": "6082cc8a7eb7af765469e737",
"answers": [
"1"
],
"fileAnswers": [],
"comment": "Explained the answer here",
"questionId": "6080093d6ff4fb63493e3123",
"instanceId": "6082cc827eb7af765469e736",
"dimension": {
"dimensionId": 0,
"dimensionName": ""
},
"updateAt": "2024-05-23T13:32:57.635"
}
}
]