作成¶
POST /api/v1/dialing_task/add
概要¶
Body リクエストパラメータ¶
| パラメータ名 | 型 | 必須 | 説明 |
|---|---|---|---|
| type | string | Y | テストタイプ 空許可: false $lowerIn: ['http', 'tcp', 'dns', 'browser', 'icmp', 'websocket', 'ssl', 'netpath'] |
| regions | array | Y | リージョンリスト 空許可: False |
| task | json | Y | タスク設定 空許可: False $maxDictLength: 20000 |
| task.url | string | URL 空許可: False |
|
| task.method | string | type が browser の場合はオプション 空許可: 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 | 詳細オプション 空許可: False |
|
| task.advance_options_headless | json | browser の詳細オプション設定 空許可: 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 | テストごとに送信する ping の数 空許可: 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 例: ['xx', 'yy'] |
パラメータ補足説明¶
データ説明.
| パラメータ名 | 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 でなければならず、少なくとも 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/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"type":"http","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"
}