POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
CreateTaskFromTemplate
<Common request parameters>
{
"TemplateId"
:
626
,
# The template ID inquired from the previous step
"TaskConfig"
:
{
"TaskTitle"
:
"This is an example of creating an experiment from the API"
,
# Experiment name
,
if it is not provided
,
the template name will be used by default.
"TaskGroupsConfig"
:
[
{
"TaskGroupInstances"
:
[
"ins-xxxxxxxx"
# Instance object ID associated with the action group
,
such as resource IDs for CVM
,
CLB
,
etc.
]
}
]
}
}
{
"Response"
:
{
"RequestId"
:
"f0aee8ac-2ed3-4a7f-a25b-f0d7d228dd30"
,
"TaskId"
:
3256
# experiment ID
}
}
{"Response": {"RequestId": "3e7fa74e-9045-4f01-88d4-ee158affe905",Common: [ # General parameters, corresponding to TaskActionGeneralConfiguration in the subsequent action experiment creation.{"ActionId": 466,"ActionName": DNS tampering,"ConfigDetail": [{"Type": "input","Lable": Action Alias,"Field": AliasTitle, # Action parameter key"DefaultValue": "", # The default value for the action parameter"Config": "{}","Required": 0, # If it is required (0 -- No 1 -- Yes)"Validate": "{}","Visible": "{}"},{"Type": "number","Lable": Pre-Wait Time (s),"Field": "PreTimeWait","DefaultValue": "0",Config: "{\\"max\\": 86400, \\"min\\": 0, \\"tooltip\\": \\"Only for auto-advance mode\\"}","Required": 0,"Validate": "{}","Visible": "{}"},{"Type": "number","Lable": Post-Wait Time (s),"Field": "AfterTimeWait","DefaultValue": "0",Config: "{\\"max\\": 86400, \\"min\\": 0, \\"tooltip\\": \\"Only for auto-advance mode\\"}","Required": 0,"Validate": "{}","Visible": "{}"},{"Type": "number","Lable": Action Timeout Period (s),"Field": "ActionTimeout","DefaultValue": "1800","Config": "{\\"max\\": 86400, \\"min\\": 0, \\"tooltip\\": \\"Action timeout period\\"}","Required": 0,"Validate": "{}","Visible": "{\\"op\\": \\"<\\", \\"type\\": \\"need_insert\\", \\"value\\": 0, \\"relatedField\\": \\"ActionTimeout\\"}"}]}],Results: [ # Custom parameters, corresponding to TaskActionCustomConfiguration in the subsequent action experiment creation.{"ActionId": 466,"ActionName": DNS tampering,"ConfigDetail": [{"Type": "number","Lable": Duration (s),"Field": "duration","DefaultValue": "180","Config": "{\\"max\\": 1800, \\"min\\": 0}","Required": 1,"Validate": "{}","Visible": "{}"},{"Type": "input","Lable": Domain Name,"Field": "domain", # Action parameter key"DefaultValue": "", # The default value for the action parameter"Config": "{}","Required": 1, # If it is required (0 -- No 1 -- Yes)"Validate": "{}","Visible": "{}"},{"Type": "input","Lable": "IP","Field": "ip","DefaultValue": "","Config": "{}","Required": 1,"Validate": "{}","Visible": "{}"}]}],"ResourceOffline": []}}
POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
CreateTaskFromTemplate
<Common request parameters>
{"TaskActionId": 462, # Action IDTaskInstances: ["ins-xxxxxxxx
"], # Resource object instance ID"TaskTitle": Network Packet Loss, # Experiment nameTaskDescription: "This experiment was created from the openapi", # Experiment descriptionTaskActionCustomConfiguration: "{\\"interfaces\\": \\"eth0\\"}" # Custom action parameters, should be serialized.}
{"Response": {"RequestId": "f0aee8ac-2ed3-4a7f-a25b-f0d7d228dd30","TaskId": 150}}
POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
DescribeTask
<Common request parameters>
{
”RequestId“
:
"02185fc4-0e8f-49ed-a8d5-6d0788d0e60c"
,
"TaskId"
:
"3256"
# The experiment ID returned from the experiment creation process mentioned above
}
API Output
{
"RequestId"
:
"02185fc4-0e8f-49ed-a8d5-6d0788d0e60c"
,
"Task"
:
{
"TaskId"
:
3256
,
"TaskTitle"
:
"This is an example of creating an experiment from the API"
,
"TaskDescription"
:
"Test an empty operation action"
,
"TaskTag"
:
""
,
"TaskStatus"
:
1002
,
"TaskStatusType"
:
0
,
"TaskProtectStrategy"
:
null
,
"TaskCreateTime"
:
"2023-08-14 11:55:02"
,
"TaskUpdateTime"
:
"2023-08-14 14:48:00"
,
"TaskStartTime"
:
"2023-08-14 14:48:01"
,
"TaskEndTime"
:
null
,
"TaskExpect"
:
null
,
"TaskSummary"
:
null
,
"TaskMode"
:
1
,
"TaskRegionId"
:
1
,
"TaskPauseDuration"
:
60
,
"TaskOwnerUin"
:
"100032429988"
,
"TaskPlanId"
:
null
,
"TaskPlanTitle"
:
null
,
"TaskGroups"
:
[
{
"TaskGroupActions"
:
[
{
"TaskGroupInstances"
:
[
{
"TaskGroupInstanceId"
:
24375
,
# Task action instance ID
"TaskGroupInstanceObjectId"
:
"ins-bfydnvta"
,
# Resource object ID
"TaskGroupInstanceStatus"
:
3001
,
"TaskGroupInstanceStatusType"
:
0
,
"TaskGroupInstanceExecuteLog"
:
null
,
"TaskGroupInstanceStartTime"
:
null
,
"TaskGroupInstanceEndTime"
:
null
,
"TaskGroupInstanceCreateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceUpdateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceIsRedo"
:
false
,
"TaskGroupInstanceExecuteTime"
:
null
}
,
{
"TaskGroupInstanceId"
:
24376
,
# Task action instance ID
"TaskGroupInstanceObjectId"
:
"ins-ehxmry76"
,
# Resource object ID
"TaskGroupInstanceStatus"
:
3001
,
"TaskGroupInstanceStatusType"
:
0
,
"TaskGroupInstanceExecuteLog"
:
null
,
"TaskGroupInstanceStartTime"
:
null
,
"TaskGroupInstanceEndTime"
:
null
,
"TaskGroupInstanceCreateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceUpdateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceIsRedo"
:
false
,
"TaskGroupInstanceExecuteTime"
:
null
}
]
,
"TaskGroupActionId"
:
11395
,
# Task action ID
"ActionId"
:
12
,
"ActionTitle"
:
"Empty Operation"
,
"ActionApiType"
:
1
,
"ActionType"
:
"Platform"
,
"ActionRisk"
:
"Low risk"
,
"ActionAttribute"
:
1
,
"TaskGroupActionOrder"
:
1
,
"TaskGroupActionGeneralConfiguration"
:
"{\\"AliasTitle\\": \\"\\", \\"PreTimeWait\\": 0, \\"ActionTimeout\\": 1800, \\"AfterTimeWait\\": 0}"
,
"TaskGroupActionCustomConfiguration"
:
"{}"
,
"TaskGroupActionStatus"
:
2002
,
"TaskGroupActionStatusType"
:
0
,
"TaskGroupActionRandomId"
:
156878
,
"TaskGroupActionRecoverId"
:
193278
,
"TaskGroupActionExecuteId"
:
null
,
"TaskGroupActionCreateTime"
:
"2023-08-14 11:55:02"
,
"TaskGroupActionUpdateTime"
:
"2023-08-14 14:48:00"
,
"IsExecuteRedo"
:
false
,
"TaskGroupActionExecuteTime"
:
null
}
,
{
"TaskGroupInstances"
:
[
{
"TaskGroupInstanceId"
:
24377
,
# Task action instance ID
"TaskGroupInstanceObjectId"
:
"ins-bfydnvta"
,
# Resource object ID
"TaskGroupInstanceStatus"
:
3001
,
"TaskGroupInstanceStatusType"
:
0
,
"TaskGroupInstanceExecuteLog"
:
null
,
"TaskGroupInstanceStartTime"
:
null
,
"TaskGroupInstanceEndTime"
:
null
,
"TaskGroupInstanceCreateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceUpdateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceIsRedo"
:
false
,
"TaskGroupInstanceExecuteTime"
:
null
}
,
{
"TaskGroupInstanceId"
:
24378
,
# Task action instance ID
"TaskGroupInstanceObjectId"
:
"ins-ehxmry76"
,
# Resource object ID
"TaskGroupInstanceStatus"
:
3001
,
"TaskGroupInstanceStatusType"
:
0
,
"TaskGroupInstanceExecuteLog"
:
null
,
"TaskGroupInstanceStartTime"
:
null
,
"TaskGroupInstanceEndTime"
:
null
,
"TaskGroupInstanceCreateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceUpdateTime"
:
"2023-08-14 14:48:00"
,
"TaskGroupInstanceIsRedo"
:
false
,
"TaskGroupInstanceExecuteTime"
:
null
}
]
,
"TaskGroupActionId"
:
11396
,
# Task action ID
"ActionId"
:
13
,
"ActionTitle"
:
"Empty Operation (rollback)"
,
"ActionApiType"
:
1
,
"ActionType"
:
"Platform"
,
"ActionRisk"
:
"Low risk"
,
"ActionAttribute"
:
2
,
"TaskGroupActionOrder"
:
2
,
"TaskGroupActionGeneralConfiguration"
:
"{\\"PreTimeWait\\": 0, \\"ActionTimeout\\": 1800, \\"AfterTimeWait\\": 0}"
,
"TaskGroupActionCustomConfiguration"
:
"{}"
,
"TaskGroupActionStatus"
:
2001
,
"TaskGroupActionStatusType"
:
0
,
"TaskGroupActionRandomId"
:
193278
,
"TaskGroupActionRecoverId"
:
null
,
"TaskGroupActionExecuteId"
:
156878
,
"TaskGroupActionCreateTime"
:
"2023-08-14 11:55:02"
,
"TaskGroupActionUpdateTime"
:
"2023-08-14 11:55:02"
,
"IsExecuteRedo"
:
false
,
"TaskGroupActionExecuteTime"
:
null
}
]
,
"TaskGroupId"
:
4684
,
# Action group ID
"TaskGroupTitle"
:
"abc"
,
"TaskGroupDescription"
:
"abc"
,
"TaskGroupOrder"
:
1
,
"TaskGroupMode"
:
1
,
"TaskGroupInstanceList"
:
[
"ins-bfydnvta"
,
"ins-ehxmry76"
]
,
"ObjectTypeId"
:
1
,
"TaskGroupCreateTime"
:
"2023-08-14 11:55:02"
,
"TaskGroupUpdateTime"
:
"2023-08-14 11:55:02"
,
"TaskGroupInstancesExecuteRule"
:
[
{
"TaskGroupInstancesExecuteMode"
:
1
}
]
,
"TaskGroupSelectedInstanceList"
:
[
"ins-bfydnvta"
,
"ins-ehxmry76"
]
,
"TaskGroupDiscardInstanceList"
:
[
]
}
]
,
"TaskMonitors"
:
[
]
,
"TaskPolicy"
:
null
,
"Tags"
:
[
]
}
,
"ReportInfo"
:
null
}
POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
ExecuteTask
<Common request parameters>
{
"TaskId"
:
"3256"
}
{
"Response"
:
{
"RequestId"
:
"46924e75-a149-4130-aac0-853dbf0abea9"
}
}
POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
ExecuteTaskInstance
<Common request parameters>
{
"TaskId"
:
"3256"
,
"TaskActionId"
:
"11396"
,
# Task action ID (obtained from the experiment inquiry response)
"TaskInstanceIds"
:
[
"xxxxxxxx-01"
,
# Task action instance ID (obtained from the experiment inquiry response)
"xxxxxxxx-02"
]
,
"IsOperateAll"
:
true
,
# Whether to execute the entire task. When
true
is set
,
TaskInstanceIds will be ignored
,
and all instances provided during experiment creation will be executed.
"ActionType"
:
2
,
#
2--Execute, 3--Skip, 5--Retry
"TaskGroupId"
:
4684
,
# Action group ID (obtained from the experiment inquiry response)
}
{
"Response"
:
{
"RequestId"
:
"6549ed1a-911f-46dd-b6cd-2c02d5bd180f"
}
}
ActionType
:POST / HTTP/
1.1
Host
:
cfg.tencentcloudapi.com
Content-Type
:
application/json
X-TC-Action
:
ModifyTaskRunStatus
<Common request parameters>
{
"TaskId"
:
3256
,
# Experiment task ID
"Status"
:
1004
,
# End status code
,
no need to modify
"Summary"
:
"This experiment meets the expectations"
,
#
Experiment conclusion
"IsExpect"
:
true
,
#
Is the execution result as expected?}
{
"Response"
:
{
"RequestId"
:
"e38eca72-e4ae-4a86-9696-7df399e672bd"
}
}
Was this page helpful?