修改¶
POST /api/v1/dialing_task/{task_uuid}/modify
概述¶
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| task_uuid | string | Y | 云拨测任务的 ID |
Body 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| regions | array | Y | 地域列表 允许为空: False |
| task | json | Y | 任务配置 允许为空: False $maxDictLength: 65536 |
| task.url | string | url 允许为空: False |
|
| task.method | string | method 允许为空: False |
|
| task.name | string | Y | 任务名称,trim 后非空且最长 256 字符,并保存 trim 后结果 允许为空: False |
| task.frequency | string | Y | 拨测频率 允许为空: False 可选值: ['1m', '5m', '15m', '30m', '1h', '6h', '12h', '24h'] |
| task.schedule_type | string | 频率类型 允许为空: False 可选值: ['frequency', 'crontab'] |
|
| task.crontab | string | crontab 表达式 允许为空: False |
|
| task.advance_options | json | advance_options 允许为空: False |
|
| task.advance_options_headless | json | browser 的 advance_options 设置 允许为空: False |
|
| task.success_when_logic | string | success_when 内条件的逻辑关系, 默认为and允许为空: False 可选值: ['and', 'or'] |
|
| task.success_when | array | success_when 允许为空: False |
|
| task.enable_traceroute | boolean | 路由跟踪 允许为空: False |
|
| task.packet_count | integer | 每次拨测发送 pings 数量 允许为空: False |
|
| task.protocol | string | type=netpath 时,探测协议 tcp/udp/icmp 允许为空: False |
|
| task.host | string | type=tcp/icmp/ssl/netpath 时,必填参数 允许为空: False |
|
| task.port | string | type=tcp/ssl 或 type=netpath 且协议为 tcp/udp 时,必填参数;NetPath ICMP 会忽略 允许为空: False |
|
| task.server_name | string | type=ssl 时,选填参数 允许为空: False |
|
| task.timeout | string | type=tcp/icmp/ssl 时,选填参数 允许为空: False |
|
| task.ignore_server_certificate_error | boolean | type=ssl 时,是否忽略服务端证书错误 允许为空: False |
|
| task.message | string | type=websocket,必填参数 允许为空: False |
|
| task.post_mode | string | 可用性判断模式 默认-default 脚本模式-script 允许为空: False |
|
| task.post_script | string | 脚本内容 允许为空: False 允许为空字符串: True |
|
| tags | array | 标签名称列表 允许为空: False |
参数补充说明¶
数据说明.
| 参数名 | type | 必选 | 说明 |
|---|---|---|---|
| type | string | Y | 云拨测类型,可选选项http,tcp,dns, browser,tcp,icmp,websocket,ssl,netpath |
| regions | array | Y | 任务执行区域 |
| task | json | Y | 任务详情 |
| task.name | string | Y | 任务名称 |
| task.url | string | Y | url |
| task.method | string | Y | url 请求方法 |
| task.status | string | Y | 任务状态,可选值ok,stop |
| task.frequency | string | Y | 任务频率 |
| task.schedule_type | string | N | 任务频率类型,可选值frequency,crontab |
| task.crontab | string | N | crontab 表达式 |
| task.advance_options | json | Y/N | type=netpath 时必填,仅允许 timeout/source_name/target_name/max_ttl/e2e_queries/traceroute_queries |
| task.protocol | enum | Y/N | type=netpath 时必填,可选值:[tcp, udp, icmp] |
| task.success_when_logic | enum | N | 可选值:[and, or], success_when 参数内的逻辑关系,默认为 and |
| task.success_when | array | Y/N | type=http/netpath 时必传,type=browser 时为非必传参数 |
| task.enable_traceroute | boolean | N | type=tcp/icmp 时,此参数选填 | |
| task.packet_count | integer | N | type=icmp 时,此参数选填 | | |
| task.host | string | N | type=tcp/icmp/ssl/netpath 时必填 | |
| task.port | string | N | type=tcp/ssl 或 type=netpath 且协议为 tcp/udp 时必填;NetPath ICMP 会忽略该字段 | |
| task.advance_options.timeout | string | Y/N | type=netpath 时必填,范围 1s-30s |
| task.server_name | string | N | type=ssl 时,选填参数 |
| task.timeout | string | N | type=tcp/icmp/ssl 时,此参数选填 |
| task.ignore_server_certificate_error | boolean | N | type=ssl 时,是否忽略服务端证书错误 |
| task.message | string | Y/N | type=websocket 时,此参数必填 | |
| task.post_mode | string | N | 可用性判断模式 默认-default 脚本模式-script |
| task.post_script | string | N | 可用性判断脚本内容 |
| tags | array | N | 标签列表 |
NetPath 任务合同(type=netpath)
| 字段 | 类型 | 必选 | 约束 |
|---|---|---|---|
| task.name | string | Y | trim 后非空且最长 256 字符,并保存 trim 后结果 |
| task.protocol | string | Y | tcp、udp、icmp,大小写不敏感 |
| task.host | string | Y | trim 后非空 |
| task.port | string | TCP/UDP 必选 | 表示 1-65535 的纯数字字符串,允许前导零并保留原值;ICMP 会忽略 |
| task.success_when_logic | string | Y | and 或 or |
| task.success_when | array | Y | 外层长度必须为 1,且至少包含一条有效条件 |
| task.advance_options.timeout | string | Y | 1s-30s 的整数秒字符串 |
| task.advance_options.max_ttl | integer | Y | TCP/ICMP:1-60;UDP:1-255 |
| task.advance_options.e2e_queries | integer | Y | 1-100 |
| task.advance_options.traceroute_queries | integer | Y | 1-10 |
| task.advance_options.source_name | string | N | trim 后为空则删除,非空最长 128 字符 |
| task.advance_options.target_name | string | N | trim 后为空则删除,非空最长 128 字符 |
success_when[0] 允许以下指标,每个指标值均为非空条件数组,条件对象只允许 op 和 target:
| 指标 | op | target |
|---|---|---|
e2e_rtt_avg、e2e_rtt_min、e2e_rtt_max、e2e_rtt_variation_avg、e2e_rtt_variation_max |
lt/gt/leq/geq/eq |
非负毫秒字符串,如 0.5ms |
e2e_probe_loss_percent |
lt/gt/leq/geq/eq |
0-100 的 JSON number |
hop_count |
lt/gt/leq/geq/eq |
非负 JSON integer |
e2e_status |
eq |
reached/partial/unknown/failed |
traceroute_status |
eq |
reached/partial/failed |
{
"type": "netpath",
"regions": ["reg_xxx"],
"task": {
"name": "api-to-db",
"protocol": "tcp",
"host": "db.internal",
"port": "0443",
"frequency": "5m",
"success_when_logic": "and",
"success_when": [{
"e2e_rtt_avg": [{"op": "lt", "target": "100ms"}],
"e2e_probe_loss_percent": [{"op": "leq", "target": 1.5}],
"traceroute_status": [{"op": "eq", "target": "reached"}]
}],
"advance_options": {
"timeout": "10s",
"max_ttl": 30,
"e2e_queries": 10,
"traceroute_queries": 3,
"source_name": "API",
"target_name": "DB"
}
}
}
* 注意 *: 拨测任务 task 参数内部的具体细节可参考 自定义拨测¶
{
"regions": [hangzhou, shanghai],
"task":{
"url":"http://example.com/some/api",
"method":"POST",
"external_id":"外部系统中给该任务定义的 ID",
"post_url":" 这个参数由 Studio 后端提供 https://dataway.cn?token=tkn_xxx",
"status":"ok/stop",
"name":"任务命名",
"frequency":"1m",
"regions":"beijing",
"advance_options":{
"request_options":{
"follow_redirect":true,
"headers":{
"header1":"value1",
"header2":"value2"
},
"cookies":"",
"auth":{
"username":"",
"password":""
}
},
"request_body":{
"body_type":"text/plain|application/json|text/xml",
"body":""
},
"certificate":{
"ignore_server_certificate_error":false,
"private_key":"",
"certificate":""
},
"proxy":{
"url":"",
"headers":{
"header1":"value1"
}
}
},
"success_when_logic": "and",
"success_when":[
{
"body":{
"contains":"",
"not_contains":"",
"is":"",
"is_not":"",
"match_regex":"",
"not_match_regex":""
},
"header":{
"header-name":{
"contains":"",
"not_contains":"",
"is":"",
"is_not":"",
"match_regex":"",
"not_match_regex":""
},
"another-header-name":"..."
},
"response_time":"100ms",
"status_code":[
{ "is":"200" },
{ "is_not":"400"},
{"match_regex":"ok*"},
{"not_match_regex":"*bad"}
]
},
{
"AND_another_assert":"..."
}
]
},
"tags": ["标签名称"]
}
*** task.frequency 参数说明 *
体验版工作空间的时间频率范围是 30m/1h/6h/12h/24h
请求例子¶
curl 'https://openapi.guance.com/api/v1/dialing_task/dial_xxxx32/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"regions":["reg_xxxx20"],"task":{"frequency":"1m","method":"GET","url":"https://www.baidu.com","name":"test","advance_options":{"request_options":{"follow_redirect":false,"headers":{},"cookies":"","auth":{"username":"","password":""}},"request_body":{"body_type":"","body":""},"secret":{"not_save":false}},"success_when":[{"body":[{"contains":"200"}]}],"success_when_logic":"and"},"tags":["test"]}' \
--compressed
响应¶
{
"code": 200,
"content": {
"createAt": 1686193610,
"creator": "acnt_xxxx32",
"deleteAt": -1,
"id": null,
"regions": [
"reg_xxxx20"
],
"status": 0,
"tagInfo": [
{
"id": "tag_xxxx32",
"name": "test"
}
],
"task": {
"advance_options": {
"request_body": {
"body": "",
"body_type": ""
},
"request_options": {
"auth": {
"password": "",
"username": ""
},
"cookies": "",
"follow_redirect": false,
"headers": {}
},
"secret": {
"not_save": false
}
},
"external_id": "dial_xxxx32",
"frequency": "1m",
"method": "GET",
"name": "test",
"owner_external_id": "wksp_xxxx32",
"post_url": "http://testing-openway.cloudcare.cn?token=tkn_xxxxx",
"status": "ok",
"tagInfo": [],
"success_when": [
{
"body": [
{
"contains": "200"
}
]
}
],
"success_when_logic": "and",
"url": "https://www.baidu.com"
},
"type": "http",
"updateAt": 1686193610,
"updator": "acnt_xxxx32",
"uuid": "dial_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "712401530723551303"
}