Skip to main content

Instance

Create instance#

Creates a new survey instance (a single "run" of a template). Returns just the new instance's id โ€” useGet instance by id to fetch the full object.

Request body:

AttributeTypeDescriptionNullable
templateIdStringIdentifier of the templatefalse
typeEnum of stringType of instance: STANDALONE, TASK, APPLICATIONfalse
executorIdIntegerIdentifier of the executortrue
executorNameStringExecutor nametrue
shopIdIntegerIdentifier of the storetrue

Response

Returns the identifier of the created instance, as a plain string

Examples

curl --request POST https://api.qvalon.com/v1/survey/instances \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"templateId":"606ac4f65b784e60cb88cb5b","shopId":1505,"type":"STANDALONE","executorId":1,"executorName":"John Vu"}'
200 OK
"6082d47b7eb7af765469e73e"

Get instance by id#

Returns the full instance object, including its current grade/result and completion status.

Examples

curl https://api.qvalon.com/v1/survey/instances/6082d47b7eb7af765469e73e \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"id": "6082d47b7eb7af765469e73e",
"templateId": "606ac4f65b784e60cb88cb5b",
"type": "STANDALONE",
"shopId": 1505,
"shopName": "Store 01",
"executorId": 1,
"executorName": "John Vu",
"sumGradeResult": 0,
"maxGradeResult": 0,
"percentGradeResult": 0,
"withGrades": false,
"finished": false,
"creationDate": "2024-05-23T13:32:00.000",
"finishDate": null
}

Finish instance#

Marks the instance as finished, calculating its final grade/result.

Examples

curl --request PATCH https://api.qvalon.com/v1/survey/instances/6082d47b7eb7af765469e73e/finish \
--header 'Authorization: Bearer <your_token>'
200 OK
{
"id": "6082d47b7eb7af765469e73e",
"templateId": "606ac4f65b784e60cb88cb5b",
"finished": true,
"finishDate": "2024-05-23T13:40:00.000"
}

Delete instance#

Deletes one or more instances. The single-id form (DELETE /survey/instances/{id}) and the batch form (DELETE /survey/instances with a JSON array of ids in the body) both work.

Examples

curl --request DELETE https://api.qvalon.com/v1/survey/instances/6082d47b7eb7af765469e73e \
--header 'Authorization: Bearer <your_token>'
200 OK
{}