Skip to content

Timer Schedule

Timer's frequency is determined by a JSON object assigned to the frequency property. For example, the following declaration sets the timer's frequency as 'weekly' which will be repeated every week on Mondays.

frequency: {
    schedule: 'weekly',

    repeat: {'every':1,'on':[2]}
  }

The 'frequency' JSON object has the following properties:

Property name
Required
Data Type
Description
schedule
Yes
String
Defines how frequently the timer should run. Possible values are:
  • 'once' - the timer will run only one time.
  • 'daily' - the timer will run on daily basis, repeated every XX number of days set by the repeat property.
  • 'weekly' - the timer will run on weekly basis, on the specified days, repeated every XX number of weeks.
  • 'monthly' - the timer will run on monthly basis, on the specified months, dates, or days of the week.
repeat
No
JSON Object
Defines how frequently the timer execution should be repeated. The structure of the object varies depending on the value set in the schedule property. See the table below for details.

The repeat property is a JSON object. The structure of the object varies depending on the value of the schedule property:

schedule property value
repeat object syntax
Description
'once'
Does not apply.
Repeat object must not be present.
'custom'
{
 'every':NUMBER
}
NUMBER is the number of seconds between each execution of the timer.  For example:
{'every':100} - indicates that the timer should execute every 100 seconds.
{'every':5} - requests the timer to run every 5 seconds.

The highest possible value is 86400 seconds. The lower limit of the allowed values depends on the billing plan:
Free plan - 60 seconds
Backendless Plus - 5 seconds
Cloud Enterprise - 1 second
'daily'
{
 'every':NUMBER
}
NUMBER is the number of days between each execution of the timer. For example:
{'every':1} - indicates that the timer should execute every day.
{'every':5} - requests the timer to run every 5 days.
'weekly'
{
 'every':NUMBER,
 'on':[1,2,3,4,5,6,7]
}
NUMBER is the number of weeks between each execution of the timer. Numbers in the 'on' array indicate the days of the week when the timer should run - all are optional, but at least one must be present. 1 indicates Sunday, 2 - Monday and so on. For example:
{'every':2, 'on':[2,5]} - requests the timer to run every 2 weeks (every other week) on Monday (2) and Thursday (5).
'monthly'
{
 'every':[MONTHS ARRAY],
 'on':
 {
    'days':[DAYS ARRAY],
    'weekdays':
    {
      'on':[WEEK ASSIGNMENT],
      'weekdays':[1,2,3,4,5,6,7]
    }
 }
}
MONTHS ARRAY is a numeric array of numbers representing months when the timer should run. 1 stands for January and 12 is for December. For example: 'every'``:[1,3,11] indicates that the monthly timer should run every January, March and November. Once the months when the timer runs are established, the 'on' property is used to set the detailed schedule. There are two mutually exclusive options: 'days' and 'weekdays'. If one is set, the other one must be null.
DAYS ARRAY is a numeric array of days on which the timer should run. 1 represents the first day of the month, 31 stands for the 31st. For example: 'days':[1,5,10] indicates that the timer must run on the 1st, 5th and 10th days of the selected months.
WEEK ASSIGNMENT is an array of week indicators with possible values: 'first', 'second', 'third', 'fourth' and 'last'. These values are used in combination with the 'weekdays' property which is an array of numbers. The numbers in the 'weekdays' array indicate the days of the week when the timer should run - all are optional, but at least one must be present. 1 indicates Sunday, 2 - Monday and so on. For example:
'weekdays':
{
'on':['first', 'last'],
'weekdays':[1,3,7]
}
requests the monthly timer to run on the first and last Sunday, Tuesday and Sunday of the months from the MONTHS ARRAY.