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
nameStringRule name and task namefalse
activeBooleanFlag indicating this 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 rule will be start in HH:mm formatfalse
generationRuleObjectSelect period executed
See Generation rule object
false
taskTypeEnum of stringAvailable types:COMMON,SURVEY,PHOTO_REPORTfalse
descriptionStringTask descriptionfalse
customObserversList objectsSet custom observers for task.
See Observer object
true
daysToCompleteIntegerCount of days to complete taskfalse
executorsObjectSee Executors object false
executorCommentRequiredBooleanExecutors is obliged to leave a commentfalse
formTemplateIdStringSurvey template id
Required for SURVEY task type
true
loadFromGalleryProhibitedBooleanBlock uploading photos from the galleryfalse
minAttachmentsCountIntegerMin. the number of attachments that the executor must attachfalse
notificationPeriodEnum of stringFrequency of reminders for executors:
daily, weekly, deadline, dayBeforeDeadline
false
notificationsList objectsSet custom notifications for task.
See Notification object
true
observersEnabledBooleanObservers enablefalse
needApprovalBooleanFlag indicating this task need approvalfalse
isOnlyOneRequiredBooleanThere is only one sub-task to complete in the storefalse

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,"selectedPeriodicity":{"day":null,"months":null,"type":"daily","weekDays":[]},"needApproval":false,"scheduledTime":"00:00","isOnlyOneRequired":false}'
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#

Find task generation rule by 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 periodicity filter setfalse
monthsList of integersFind by periodicity months, required if periodicity filter setfalse
authorsList of integersFind by author idsfalse
executorsList of integersFind by executors idsfalse
divisionIdsList of integersFind by divisions idsfalse
regionIdsList of integersFind by regions idsfalse
shopIdsList of integersFind by stores idsfalse
typeSet of stringFind by tasks 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#

Delete generation rule

Examples

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