Skip to main content

Scheduled tasks

Create generation rule#

You can create a rule for generating tasks, set the period for the rule to work, frequency and time of execution.

Request body:

AttributeTypeDescriptionNullable
nameStringName of the rule and of the tasks it generatesfalse
activeBooleanWhether the rule is activefalse
activeFromISO DateTimeDate and time from which the rule will be executed
Format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
false
activeToISO DateTimeDate and time when the rule will stop executing
Format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
false
scheduledTimeTimeTime when the rule will start, in HH:mm formatfalse
generationRuleObjectDefines how often the rule runs
See Generation rule object
false
taskTypeEnum of stringType of the task. Available types: COMMON, SURVEY, PHOTO_REPORTfalse
descriptionStringTask descriptionfalse
customObserversList objectsCustom observers for the task.
See Observer object
true
daysToCompleteIntegerNumber of days to complete the taskfalse
executorsObjectSee Executors object false
executorCommentRequiredBooleanWhether the executor is required to leave a commentfalse
formTemplateIdStringIdentifier of the survey template.
Required for the SURVEY task type
true
loadFromGalleryProhibitedBooleanProhibit uploading photos from the galleryfalse
minAttachmentsCountIntegerMinimum number of attachments the executor must addfalse
notificationPeriodEnum of stringFrequency of reminders for executors:
daily, weekly, deadline, dayBeforeDeadline
false
notificationsList objectsCustom notification settings for the task.
See Notification object
true
observersEnabledBooleanWhether observers are enabled for the taskfalse
needApprovalBooleanWhether the task requires approval after completionfalse
withManyExecutorsBooleanControls how responses are created when a store (object) has several matching executors.
true โ€” a single shared response is created per store for all its executors, so the task needs to be completed only once.
false โ€” a separate response is created for each executor, and every executor must complete their own.
true

Response

Returns Task template object

Examples

curl --request POST https://api.qvalon.com/v1/tasks-manual/templates \
--header 'Authorization: Bearer <your_token>' \
--header 'Content-Type: application/json' \
-d '{"name":"test","active":true,"activeFrom":"2021-06-17T00:00:00.000Z","activeTo":"2021-06-17T23:59:59.999Z","taskType":"COMMON","description":"test description","daysToComplete":"1","generationRule":{"type":"daily","days":[],"months":[]},"loadFromGalleryProhibited":false,"executorCommentRequired":true,"notificationPeriod":"daily","executors":{"executorRole":"SHOP","allCompanySelected":false,"divisionIds":[28],"regionIds":[],"shopIds":[],"bnIds":[1003]},"customObservers":[{"observerId":1603,"observerName":"John Doe"}],"observersEnabled":true,"needApproval":false,"scheduledTime":"00:00","withManyExecutors":true}'
200 OK
{
"id": 4,
"active": true,
"name": "test",
"authorId": 1,
"authorName": "System Administrator",
"activeFrom": "2021-06-17T00:00:00.000Z",
"activeTo": "2021-06-17T23:59:59.999Z",
"scheduledTime": "00:00",
"generationRule": {
"type": "daily",
"days": [],
"months": []
},
"type": "COMMON"
}

Find generation rules#

Finds task generation rules matching the given filters

Request parameters:

Request ParameterTypeDescriptionRequired
activeBooleanFind by active statefalse
nameStringFind by namefalse
periodicityList of stringsFind by periodicityfalse
daysList of integersFind by periodicity days, required if the periodicity filter is setfalse
monthsList of integersFind by periodicity months, required if the periodicity filter is setfalse
authorsList of integersFind by author idsfalse
executorsList of integersFind by executor idsfalse
divisionIdsList of integersFind by division idsfalse
regionIdsList of integersFind by region idsfalse
shopIdsList of integersFind by store idsfalse
typeSet of stringFind by task types, default all typesfalse

Response

Returns a list of Task template objects

Examples

curl https://api.qvalon.com/v1/tasks-manual/templates \
--header 'Authorization: Bearer <your_token>'
200 OK
[
{
"id": 4,
"active": true,
"name": "test",
"authorId": 1,
"authorName": "System Administrator",
"activeFrom": "2021-06-17T00:00:00.000Z",
"activeTo": "2021-06-17T23:59:59.999Z",
"scheduledTime": "00:00",
"lastGenerationDate": "2021-06-17",
"generationRule": {
"type": "daily",
"days": [],
"months": []
},
"type": "COMMON"
}
]

Delete task generation rule#

Deletes the task generation rule

Examples

curl --request DELETE https://api.qvalon.com/v1/tasks-manual/templates/162 \
--header 'Authorization: Bearer <your_token>'
200 OK
{}