The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Creating Scheduled Tasks

Last updated: 2025-04-30 15:42:49

1. API Description

api request domain name: iot.cloud.tencent.com/api/exploreropen/tokenapi. this interface (AppCreateTimer) is used for users to create scheduled tasks for devices.

2. Input Parameter

Name
Type
Required
Description
AccessToken
String
Yes
Common parameter. AccessToken is used for user authentication of a logged-in user.
RequestId
String
Yes
Common parameter. Unique request ID can be generated manually. It is recommended to use uuid. Locating issues, you need to provide the RequestId for the request.
Action
String
Yes
Common parameter. This interface takes values AppCreateTimer.
ProductId
String
Yes
Associated product ID of the created scheduled task.
DeviceName
String
Yes
Device name controlled by the created scheduled task.
TimerName
String
Yes
Name of the timer.
Days
String
Yes
Timer activation time, each digit, 0: Off, 1: On, from left to right sequentially represent: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
TimePoint
String
Yes
Timer start time.
Repeat
int
Yes
Whether to loop.
0: Not required.
Requirement
Data
String
Yes
Control message sent when the timer starts.

3. Output Parameter

Name
Type
Description
RequestId
String
Common parameter. Unique request ID, same as the input parameter. Locating issues, you need to provide the RequestId for the request.
TimerId
String
Timer ID.
TimerName
String
Timer name.

4. Samples

Input Example
POST https://iot.cloud.tencent.com/api/exploreropen/tokenapi HTTP/1.1
content-type: application/json
{
"RequestId": "req_1",
"Action": "AppCreateTimer",
"ProductId": "US4*****IK",
"DeviceName": "411_3",
"AccessToken": "c1******************847e",
"TimerName": "timer_test",
"Days": "1000000", // Each 0: Off, 1: On, from left to right in sequence represent: Sunday Monday Tuesday Wednesday Thursday Friday Saturday
"TimePoint": "06:30",
"Repeat": 1, //Whether required to loop 0: Not required 1: Required
"Data": "{\"brightness\": 25}"
}
Output sample: successful
{
"Response": {
"Data": {
"TimerId": "e0e23a2b33a24652b6**********a1cf",
"TimerName": "timer_test"
},
"RequestId": "req_1"
}
}

5. Error Code

Error Code
Description
InternalError
Internal error.
InvalidParameterValue
Invalid parameter value.
InvalidParameterValue.InvalidAccessToken
The Token is invalid.