Skip to content

Create Scheduled Task

API Address:/v2/cep/enduserapi/v2/addCornJob

Request Method:POST

Request Data Type:application/json

Response Data Type:*/*

API Description:Create scheduled task

Request Example:

javascript
{
  "cacheTime": 0,
  "dayOfWeek": "",
  "dk": "",
  "enabled": true,
  "pk": "",
  "timeZone": "",
  "timers": [
    {
      "action": "",
      "cacheTime": 0,
      "delay": 0,
      "taskLogo": "",
      "taskName": "",
      "time": ""
    }
  ],
  "type": ""
}

Request Parameters:

Parameter NameDescriptionRequest TypeRequiredData TypeSchema
cmdcmdbodytrueCreate scheduled taskCreate scheduled task
  cacheTimeDownlink cache time, in seconds, range: 0-7776000falseinteger(int32)
  dayOfWeekRepeat cycle: 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday, 7: Sunday, multiple values separated by commas, required when type = custom-repeatmulti-sectionrandom
  dkDevice Keytruestring
  enabledTask status, enabled: true, disabled: falsefalseboolean
  pkProduct Keytruestring
  timeZoneTime zone. Format: +-HH:mmfalsestring
  timersTask list, when type = multi-section, limit is 2-5 taskstruearrayTask Req
    actionCommand to execute, format: Thing Model JSON stringtruestring
    cacheTimeDownlink cache time, in seconds, range: 0-7776000falseinteger
    delayDelay execution time, in seconds, required when type = delayfalseinteger
    taskLogoTask iconfalsestring
    taskNameTask namefalsestring
    timeExecution time, format: HH:mm:ss, when type = onceday-repeatcustom-repeat
  typeTask type, once: execute once, day-repeat: repeat daily, custom-repeat: repeat weekly, multi-section: multi-stage execution, delay: countdowntruestring
Authorizationheaderfalsestring

Response Status:

Status CodeDescriptionSchema
200OKApiResult«Add scheduled task»
201Created
401Unauthorized
403Forbidden
404Not Found
5066Please enter Product Key
5067Please enter Device Key
5107Please enter start time
5108Please enter end time
5109Start time format is incorrect
5110End time format is incorrect
5587Please enter task type
5588Task type parameter out of range
5589Please enter command to execute
5590Please enter day of week to execute
5591Day of week parameter out of range
5592Failed to add scheduled task
5598Please enter execution time
5599Execution time parameter out of range
5600Start time must be less than end time
5601Please enter delay execution time
5602Delay time parameter out of range
5604Task limit reached for this device

Response Parameters:

Parameter NameDescriptionTypeSchema
codeinteger(int32)integer(int32)
dataAdd scheduled taskAdd scheduled task
  ruleIdTask IDstring
extMsgstring
msgstring

Response Example:

javascript
{
	"code": 0,
	"data": {
		"ruleId": ""
	},
	"extMsg": "",
	"msg": ""
}