Skip to main content

Template

Create template#

Creates a new template. Requires the ROLE_SURVEY_ADMIN role.

Request body:

AttributeTypeDescriptionNullable
nameStringTemplate namefalse
typeEnum of stringTemplate type: FORM, PHOTO_REPORT, SURVEY, APPLICATIONtrue
quickBooleanWhether this is a template for quick surveystrue
categoryIdStringIdentifier of the template categoryfalse
gradeConditionsList objectsResult grade thresholds (only for surveys with grades). See the gradeConditions field on the Template objecttrue
showGradesBooleanWhether to show grades when taking a survey. Default falsetrue
withGradesBooleanWhether the template uses grades. Default falsetrue
deletedBooleanWhether the template is deleted. Default falsetrue
hiddenBooleanWhether the template is hidden from users. Default falsetrue

Response

Returns the created Template object

Examples

curl --request POST https://api.qvalon.com/v1/survey/templates \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"name":"Cleanliness survey","type":"SURVEY","quick":false,"categoryId":"60826e00f5636740f6ef148a","gradeConditions":[],"showGrades":true,"withGrades":true}'
200 OK
{
"id": "60826e0ef5636740f6ef148b",
"type": "SURVEY",
"categoryId": "60826e00f5636740f6ef148a",
"categoryName": "Merchandising",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey",
"withGrades": true,
"showGrades": true,
"questionsCount": 0,
"gradeConditions": [],
"labels": {},
"quick": false,
"signatureRequired": false,
"withCatalog": false
}

Update template#

Updates a template's settings, or deactivates it by passing deleted: true. The template id is part of the request body, not the URL. Requires the ROLE_SURVEY_ADMIN role.

Request body:

AttributeTypeDescriptionNullable
idStringIdentifier of the template to updatefalse
nameStringTemplate namefalse
quickBooleanWhether this is a template for quick surveystrue
categoryIdStringIdentifier of the template categoryfalse
gradeConditionsList objectsResult grade thresholds (only for surveys with grades). See the gradeConditions field on the Template objecttrue
showGradesBooleanWhether to show grades when taking a surveytrue
withGradesBooleanWhether the template uses gradestrue
deletedBooleanWhether the template is deletedtrue
hiddenBooleanWhether the template is hidden from userstrue

Response

Returns the updated Template object

Examples

curl --request PUT https://api.qvalon.com/v1/survey/templates \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"id":"60826e0ef5636740f6ef148b","name":"Cleanliness survey updated","quick":false,"categoryId":"60826e00f5636740f6ef148a","gradeConditions":[],"showGrades":false,"withGrades":false,"deleted":false,"hidden":false}'
200 OK
{
"id": "60826e0ef5636740f6ef148b",
"type": "SURVEY",
"categoryId": "60826e00f5636740f6ef148a",
"categoryName": "Merchandising",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey updated",
"withGrades": false,
"showGrades": false,
"questionsCount": 0,
"gradeConditions": [],
"labels": {},
"quick": false,
"signatureRequired": false,
"withCatalog": false
}

List templates#

Returns a list of Template objects matching the given filter.

Request parameters:

Request ParameterTypeDescriptionRequired
pageIntegerPage number (0-based)false
sizeIntegerNumber of elements per pagefalse

Request body:

AttributeTypeDescriptionNullable
idsList of stringsFind templates by idstrue
categoryIdStringFind templates by category idtrue
typeSet of stringFind templates by type: FORM, PHOTO_REPORT, SURVEY, APPLICATIONtrue
onlyActiveBooleanOnly return non-deleted templates. Default truetrue
withHiddenBooleanInclude hidden templatestrue
withQuestionsOnlyBooleanOnly return templates that have at least one questiontrue
quickBooleanFind templates by "quick" flagtrue
updateAfterLocalDateTimeOnly return templates modified after this date and timetrue
searchStringFind templates by nametrue

Examples

curl --request POST https://api.qvalon.com/v1/survey/templates/all?page=0&size=20 \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"search":"Cleanliness"}'
200 OK
[
{
"id": "606ac4f65b784e60cb88cb5b",
"type": "SURVEY",
"categoryId": "606ac4e55b784e60cb88cb5a",
"categoryName": "Merchandising",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey",
"withGrades": false,
"questionsCount": 4,
"updateAt": "2024-05-23T08:34:21.031",
"labels": {},
"quick": false,
"signatureRequired": false,
"withCatalog": false
}
]

Get short templates list#

Same filter as List templates, but returns a shorter object per template (just the fields needed to display a picker), which is cheaper for large tenants.

Request parameters:

Request ParameterTypeDescriptionRequired
pageIntegerPage number (0-based)false
sizeIntegerNumber of elements per pagefalse

Request body:

AttributeTypeDescriptionNullable
(body)ObjectSame filter fields as List templatestrue

Examples

curl --request POST https://api.qvalon.com/v1/survey/templates/short?page=0&size=20 \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"search":"Cleanliness"}'
200 OK
[
{
"id": "606ac4f65b784e60cb88cb5b",
"name": "Cleanliness survey",
"categoryId": "606ac4e55b784e60cb88cb5a",
"categoryName": "Merchandising"
}
]

Get template by id#

Returns a Template object by id

Examples

curl https://api.qvalon.com/v1/survey/templates/606ac4f65b784e60cb88cb5b \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"id": "606ac4f65b784e60cb88cb5b",
"type": "SURVEY",
"categoryId": "606ac4e55b784e60cb88cb5a",
"categoryName": "Merchandising",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey",
"withGrades": false,
"questionsCount": 4,
"updateAt": "2024-05-23T08:34:21.031",
"labels": {},
"quick": false,
"signatureRequired": false,
"catalogs": [],
"withCatalog": false,
"applications": []
}

Move to category#

Moves a template from one category to another.

Request parameters:

Request ParameterTypeDescriptionRequired
fromCategoryStringIdentifier of the template's current categorytrue
toCategoryStringIdentifier of the destination categorytrue

Response

Returns the moved Template object

Examples

curl --request PUT https://api.qvalon.com/v1/survey/templates/606ac4f65b784e60cb88cb5b/move?fromCategory=606ac4e55b784e60cb88cb5a&toCategory=608292857eb7af765469e730 \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"id": "606ac4f65b784e60cb88cb5b",
"type": "SURVEY",
"categoryId": "608292857eb7af765469e730",
"categoryName": "HR Surveys",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey",
"withGrades": false,
"questionsCount": 4,
"updateAt": "2024-05-23T09:25:35.020513",
"labels": {},
"quick": false,
"signatureRequired": false,
"withCatalog": false
}

Copy template#

Creates a copy of an existing template, including its questions. Requires the ROLE_SURVEY_ADMIN role.

Request parameters:

Request ParameterTypeDescriptionRequired
nameStringName for the copy. Defaults to the original template's name if omittedfalse
categoryIdStringCategory for the copy. Defaults to the original template's category if omittedfalse

Response

Returns the newly created Template object

Examples

curl --request POST https://api.qvalon.com/v1/survey/templates/606ac4f65b784e60cb88cb5b/copy?name=Cleanliness survey (copy) \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"id": "608286647eb7af765469e72f",
"type": "SURVEY",
"categoryId": "606ac4e55b784e60cb88cb5a",
"categoryName": "Merchandising",
"deleted": false,
"hidden": false,
"name": "Cleanliness survey (copy)",
"withGrades": false,
"questionsCount": 4,
"labels": {},
"quick": false,
"signatureRequired": false,
"withCatalog": false
}

Reorder template questions#

Sets the display order of the template's questions.

Request body:

AttributeTypeDescriptionNullable
(body)List of stringsQuestion ids, in the order they should appearfalse

Examples

curl --request PUT https://api.qvalon.com/v1/survey/templates/606ac4f65b784e60cb88cb5b/order \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '["912","913","914"]'
200 OK
{}