Skip to content

Modify



POST /api/v1/dialing_task/{task_uuid}/modify

Overview

Route Parameters

Parameter Name Type Required Description
task_uuid string Y ID of the Cloud Dial Testing task

Body Request Parameters

Parameter Name Type Required Description
regions array Y List of regions
Allow empty: False
task json Y Task configuration
Allow empty: False
$maxDictLength: 65536
task.url string URL
Allow empty: False
task.method string Method
Allow empty: False
task.name string Y Task name, non-empty after trim and max 256 characters, save trimmed result
Allow empty: False
task.frequency string Y Dial testing frequency
Allow empty: False
Allowed values: ['1m', '5m', '15m', '30m', '1h', '6h', '12h', '24h']
task.schedule_type string Frequency type
Allow empty: False
Allowed values: ['frequency', 'crontab']
task.crontab string Crontab expression
Allow empty: False
task.advance_options json Advance options
Allow empty: False
task.advance_options_headless json Browser advance options settings
Allow empty: False
task.success_when_logic string Logical relationship of conditions in success_when, default is and
Allow empty: False
Allowed values: ['and', 'or']
task.success_when array Success when conditions
Allow empty: False
task.enable_traceroute boolean Route tracing
Allow empty: False
task.packet_count integer Number of pings sent per dial test
Allow empty: False
task.protocol string Probe protocol tcp/udp/icmp when type=netpath
Allow empty: False
task.host string Required parameter when type=tcp/icmp/ssl/netpath
Allow empty: False
task.port string Required parameter when type=tcp/ssl or type=netpath with protocol tcp/udp; ignored for NetPath ICMP
Allow empty: False
task.server_name string Optional parameter when type=ssl
Allow empty: False
task.timeout string Optional parameter when type=tcp/icmp/ssl
Allow empty: False
task.ignore_server_certificate_error boolean Whether to ignore server certificate errors when type=ssl
Allow empty: False
task.message string Required parameter when type=websocket
Allow empty: False
task.post_mode string Availability judgment mode, default-default, script mode-script
Allow empty: False
task.post_script string Script content
Allow empty: False
Allow empty string: True
tags array List of tag names
Allow empty: False

Parameter Supplementary Notes

Data description.

Parameter Name Type Required Description
type string Y Cloud Dial Testing type, allowed options: http, tcp, dns, browser, tcp, icmp, websocket, ssl, netpath
regions array Y Task execution region
task json Y Task details
task.name string Y Task name
task.url string Y URL
task.method string Y URL request method
task.status string Y Task status, allowed values: ok, stop
task.frequency string Y Task frequency
task.schedule_type string N Task frequency type, allowed values: frequency, crontab
task.crontab string N Crontab expression
task.advance_options json Y/N Required when type=netpath, only allows timeout/source_name/target_name/max_ttl/e2e_queries/traceroute_queries
task.protocol enum Y/N Required when type=netpath, allowed values: [tcp, udp, icmp]
task.success_when_logic enum N Allowed values: [and, or], logical relationship within success_when parameters, default is and
task.success_when array Y/N Required when type=http/netpath, optional when type=browser
task.enable_traceroute boolean N Optional when type=tcp/icmp
task.packet_count integer N Optional when type=icmp
task.host string N Required when type=tcp/icmp/ssl/netpath
task.port string N Required when type=tcp/ssl or type=netpath with protocol tcp/udp; ignored for NetPath ICMP
task.advance_options.timeout string Y/N Required when type=netpath, range 1s-30s
task.server_name string N Optional parameter when type=ssl
task.timeout string N Optional parameter when type=tcp/icmp/ssl
task.ignore_server_certificate_error boolean N Whether to ignore server certificate errors when type=ssl
task.message string Y/N Required when type=websocket
task.post_mode string N Availability judgment mode, default-default, script mode-script
task.post_script string N Availability judgment script content
tags array N Tag list

NetPath Task Contract (type=netpath)

Field Type Required Constraint
task.name string Y Non-empty after trim and max 256 characters, save trimmed result
task.protocol string Y tcp, udp, icmp, case-insensitive
task.host string Y Non-empty after trim
task.port string Required for TCP/UDP Pure numeric string representing 1-65535, allows leading zeros and retains original value; ignored for ICMP
task.success_when_logic string Y and or or
task.success_when array Y Outer length must be 1, and at least one valid condition must be included
task.advance_options.timeout string Y Integer second string from 1s to 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 Deleted if empty after trim, max 128 characters if non-empty
task.advance_options.target_name string N Deleted if empty after trim, max 128 characters if non-empty

success_when[0] allows the following metrics, each metric value is a non-empty condition array, and condition objects only allow op and target:

Metric op target
e2e_rtt_avg, e2e_rtt_min, e2e_rtt_max, e2e_rtt_variation_avg, e2e_rtt_variation_max lt/gt/leq/geq/eq Non-negative millisecond string, e.g., 0.5ms
e2e_probe_loss_percent lt/gt/leq/geq/eq JSON number from 0-100
hop_count lt/gt/leq/geq/eq Non-negative 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"
    }
  }
}

* Note *: For specific details within the dial testing task parameters, refer to Custom Dial Testing

{
    "regions": [hangzhou, shanghai],
    "task":{
        "url":"http://example.com/some/api",
        "method":"POST",
        "external_id":"ID defined for this task in external system",
        "post_url":" This parameter is provided by Studio backend https://dataway.cn?token=tkn_xxx",
        "status":"ok/stop",
        "name":"Task 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": ["Tag name"]
}

*** task.frequency parameter description *
The time frequency range for Free Plan workspaces is 30m/1h/6h/12h/24h

Request Example

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

Response

{
    "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"
}

Feedback

Is this page helpful? ×