createTaskSchedule

Updated at:

Endpoint: console-rpa.aliyun.com/rpa/openapi/task/createTaskSchedule

HTTP method: POST

Response format: JSON

Description: Creates a scheduled task.

Request parameters

Parameter

Type

Required

Example

Description

appId

String

Yes

fb6a99a1-****-****-****-2ed9cb5a0c0d

The unique identifier of the application.

name

String

Yes

Test

The name of the scheduled task.

clientIds

String

Yes

5E77DA******CFB62A8B9527626A47F4

The robot ID. To specify multiple robots, separate the IDs with commas (,). Example: 5E77DA******CFB62A8B9527626A47F4,50E607******B36B6DECCE2BB4C2A303.

scheduleType

String

Yes

immediate

The type of the scheduled task.

Valid values: specified_time (run at a specific time), immediate (run immediately), specified_interval_time (run at a specific interval), day_interval (run at a daily interval), week_interval (run at a weekly interval), month_interval (run at a monthly interval), and cron_express (run based on a cron expression).

scheduleConfig

String

Yes

{"yearMonthDay":"2020-04-27"}

Scheduled task parameters

appParams

JSON array

No

[{"type":0,"name":"Parameter1","default":"","value":""},{"type":0,"name":"Parameter2","default":"","value":""}]

An array of parameters required for task execution. The numeric codes correspond to the following UI components: 0 (TextEdit), 1 (ComboBox), 2 (CheckedComboBox), 3 (OpenFile), 4 (OpenDir), 5 (DateEdit), 6 (ColorPick), 7 (PasswordTextEdit), 8 (HtmlTextEdit), and 9 (MultiTextEdit).

renderEnabled

Boolean

No

false

Specifies whether to keep the desktop rendered during execution. Default value: false.

The clientIds parameter specifies the ID of the robot. After you log in to the robot client, you can find the robot ID for the local machine in the About menu, as shown in the following figure.

scheduleConfig parameters

Parameter

Type

Required

Example

Description

errorHandling

boolean

No

false

The error handling policy. If set to true, the robot retries a failed task up to three times. If set to false, the task terminates immediately upon failure without a retry.

isQueueUpType

boolean

No

false

Specifies whether to add the task to a queue.

taskNumber

Integer

No

1

The number of tasks to run.

tasKPriority

Integer

No

50

The priority of the task. The value must be an integer greater than or equal to 0. A larger value indicates a higher priority.

emails

String

No

test@example.com

The email addresses for sending notifications. Separate multiple email addresses with commas (,).

forceRadio

Boolean

No

false

Specifies whether to set a forced end time for the task.

scheduleEndDt

String

No

2022-09-25 10:21

The forced end time. This parameter is required if forceRadio is set to true.

yearMonthDay

String

No

2020-04-27

The date for the task to run, in YYYY-MM-DD format.

hourMinute

String

No

05:05

The time for the task to run, in HH:mm format.

specifiedValue

String

No

intervalDay

Interval value: intervalMinute, intervalHour, intervalDay

intervalHour

String

No

1

The interval in hours. Valid values: 0 to 23.

intervalMinute

String

No

1

The interval in minutes. Valid values: 0 to 59.

intervalDay

String

No

1

The interval in days. Valid values: 0 to 29.

weeks

String

No

1

A comma-separated string of numbers from 1 (Monday) to 7 (Sunday) that represents the days of the week.

month

String

No

1

A comma-separated string of numbers from 1 to 31 that represents the days of the month.

taskScheduleStartDate

String

No

2022-09-24 10:21

The start time of the scheduled task.

The following sections show examples of the scheduleConfig parameter for different scheduleType values.

{
    "yearMonthDay":"2020-04-27",
    "hourMinute":"15:18"
}
Note

You can also include parameters such as errorHandling, isQueueUpType, taskNumber, tasKPriority, and emails.

Immediate execution: The scheduleConfig for immediate.

{
    "yearMonthDay":"2020-04-27",
    "hourMinute":"15:18" 
}
Note

You can also include parameters such as errorHandling, isQueueUpType, taskNumber, tasKPriority, and emails.

Execute at a specified interval: the scheduleConfig for specified_interval_time

{
    "scheduleEndDt":"2020-05-29 18:20:00",
    "yearMonthDay":"2020-04-29",
    "hourMinute":"17:20",
    "specifiedValue":"intervalHour", 
    "intervalHour": 9,
    "intervalDay": 0,
    "intervalMinute": 0
}
Note

The specifiedValue parameter specifies the interval unit to use, which can be intervalHour, intervalDay, or intervalMinute. For the selected unit, provide a value greater than 0 and omit the other two interval parameters. For example, if specifiedValue is intervalDay, set intervalDay to a value greater than 0 and omit intervalHour and intervalMinute. The forceRadio parameter must be set to true. You can also include parameters such as errorHandling, isQueueUpType, taskNumber, tasKPriority, and emails.

Weekly repeat: week_interval

{ 
     "scheduleEndDt":"2020-05-29 18:20:00",
     "yearMonthDay":"2020-04-27",
     "hourMinute":"21:35",
     "weeks":"1,2,3,4,5,6,7"
 }
Note

The weeks parameter specifies the days of the week for the task to run. The yearMonthDay and hourMinute parameters define the execution time for the specified days. You can also include parameters such as errorHandling, isQueueUpType, taskNumber, tasKPriority, and emails.

Monthly repeat: month_interval

{ 
     "scheduleEndDt":"2020-05-29 18:20:00",
     "hourMinute":"21:35",
     "month":"1,2,3,4,5,6,7"
}

Response parameters

For information about the common response parameters, see Response. The data field is described as follows:

Parameter

Type

Example

Description

uuid

String

1c7284b5-****-****-****-6fb3443b5a8b

The unique identifier of the scheduled task.

appId

String

fb6a99a1-****-****-****-2ed9cb5a0c0d

The unique identifier of the application.

name

String

Test

The name of the scheduled task.

groupId

String

b8e097d8-****-****-****-db5d13f8b4ca

The unique identifier of the enterprise.

status

String

wait

The status of the scheduled task.

creator

String

93bf42a1-****-****-****-4d5ec0e6260a

The unique identifier of the user who created the task.

scheduleType

String

specified_interval_time

The type of the scheduled task.

scheduleExpress

String

{"intervalHour":"1",******,"specifiedValue":"intervalHour"}

The parameters of the scheduled task, in a JSON string format.

scheduleCron

String

0 0 /1 * * ?

The cron expression that defines the task execution schedule.

scheduleStartDate

Date

1589874420000

The start time of the scheduled task, as a UNIX timestamp in milliseconds.

scheduleEndDate

Date

1590047160000

The end time of the scheduled task, as a UNIX timestamp in milliseconds.

nextTaskTime

Date

1589874420000

The next execution time, as a UNIX timestamp in milliseconds.

clientType

String

robot_unattended

Client Type

Examples

Request example

https://console-rpa.aliyun.com/rpa/openapi/task/createTaskSchedule?<common request parameters>
&appId=fb6a99a1-****-****-****-2ed9cb5a0c0d
&name=Test
&clientIds=5E77DA******CFB62A8B9527626A47F4
&scheduleType=immediate
&scheduleConfig={"yearMonthDay":"2020-04-27"}
&appParams=[{"type":0,"name":"Parameter1","default":"","value":""}]

Response example

{
    "requestId":"c4719a73-****-****-****-a4eafe886e60",
    "success":true,
    "code":0,
    "msg":"The operation was successful.",
    "msgCode":"result.success",
    "data":{
        "uuid":"1c7284b5-****-****-****-6fb3443b5a8b",
        "appId":"fb6a99a1-****-****-****-2ed9cb5a0c0d",
        "name":"Test",
        "groupId":"b8e097d8-****-****-****-db5d13f8b4ca",
        "status":"wait",
        "creator":"93bf42a1-****-****-****-4d5ec0e6260a",
        "scheduleType":"specified_interval_time",
        "scheduleExpress":"{\"intervalHour\":\"1\",\"weeks\":[],\"scheduleEndDt\":\"2020-05-21 15:46\",\"intervalMinute\":0,\"hourMinute\":\"15:47\",\"clientIds\":[\"45E2D8******A38C85344B6B2EF10FD4\"],\"yearMonthDay\":\"2020-05-19\",\"emails\":[],\"scheduleType\":\"specified_interval_time\",\"month\":[],\"appId\":\"fb6a99a1-****-****-****-2ed9cb5a0c0d\",\"intervalDay\":0,\"name\":\"Test\",\"forceRadio\":true,\"scheduleCron\":\"0 0 /1 * * ?\",\"tasKPriority\":\"\",\"taskNumber\":1,\"errorHandling\":false,\"specifiedValue\":\"intervalHour\"}",
        "scheduleCron":null,
        "scheduleStartDate":1589874420000,
        "scheduleEndDate":1590047160000,
        "nextTaskTime":1589874420000,
        "clientType":"robot_unattended"
    },
    "pager":null
}