Skip to content

Modify



POST /api/v1/incidents/schedule/{schedule_uuid}/modify

Overview

Modify schedule

Route Parameters

Parameter Name Type Required Description
schedule_uuid string Y Schedule UUID
Allow empty: False

Body Request Parameters

Parameter Name Type Required Description
name string Y Name
Allow empty: False
Max length: 256
Allow empty string: False
timezone string Timezone, default Asia/Shanghai
Example: Asia/Shanghai
Allow empty: False
Max length: 48
start string Y Time period start time
Example: 00:00
Allow empty: False
Max length: 48
end string Y Time period end time
Example: 23:59
Allow empty: False
Max length: 48
tagFilter array Filter tag UUID list
Allow empty: False
Example: ['tag1', 'tag2']
dimensionFilter string Filter dimension
Allow empty: False
Example: host:127.0.0.1
notifyTargets array Y Notification targets, includes account UUID, notification target UUID, email
Example: ['acnt_xxx', 'notify_', '[email protected]']
Allow empty: False
extend json Extended information, includes rotation notification target configuration
Allow empty: False
extend.enableRotateNotification boolean Whether to enable rotation, default off
Example: False
Allow empty: False
extend.rotationCycle string Rotation cycle, day: day, week: week, month: month, workday: workDay, weekend: weekend
Example: day
Allow empty: False
Allowed values: ['day', 'week', 'month', 'workDay', 'weekend']
extend.effectiveTime json Schedule effective time, default schedule is permanently effective, start/end time is 11-digit timestamp
Example: {'start': 1719990196, 'end': 1729990196}
Allow empty: False
scheduleStrategy array Escalation strategy rules

Parameter Supplementary Description

1. Request Parameter Description

Parameter Name type Required Description
name String Required Schedule name
start String Required Time period start time
end String Required Time period end time
timezone String Timezone
tagFilter array Filter tag UUID list
dimensionFilter array Dimension filter, currently supports equals and wildcard logic
notifyTargets array Required Notification targets, includes account UUID, notification target UUID, email
extend Json Extended information
scheduleStrategy Json Escalation strategy rules

2. dimensionFilter Parameter Description Dimension filter, currently supports equals and wildcard logic, format is key:value, for example host:127.0.0.1 means only includes dimensions where host is 127.0.0.1. Wildcard logic supports * wildcard, for example host:127.0.0.* means only includes dimensions where host starts with 127.0.0.. Also supports multiple conditions OR\AND, for example host:127.0.0.1 AND service:mysql Currently supported dimension fields are as follows: host, service, resource, pod_name, app_name, env, url


3. Parameter Description in extend

Parameter Name type Required Description
enableRotateNotification Boolean Whether to enable notification target rotation, default off
rotationCycle string Rotation cycle after enabling notification target rotation
effectiveTime json Schedule effective time configuration, default schedule is permanently effective, start/end time is 11-digit timestamp

4. Parameter Description in scheduleStrategy

Parameter Name type Required Description
scheduleStrategy[].uuid string Y Unique UUID
scheduleStrategy[].name string Y Strategy name
scheduleStrategy[].strategy array N Escalation strategy list
scheduleStrategy[].strategy[].level integer Y Level
scheduleStrategy[].strategy[].notifyConfig array Y Notification configuration list
scheduleStrategy[].strategy[].notifyConfig[].notifyType array Y Notification target type member - member object - notification target
scheduleStrategy[].strategy[].notifyConfig[].notifyObject array Y Notification target list, watchkeeper represents the current on-duty person
scheduleStrategy[].strategy[].notifyConfig[].notifyMethod array N Notification method, if it's a notification target then no need to pass mobile - phone message - SMS email - email
scheduleStrategy[].strategy[].ifRepeatNotify boolean Y Whether to repeat sending notifications
scheduleStrategy[].strategy[].repeatNotifyInterval integer N Repeat notification sending interval, unit seconds
scheduleStrategy[].strategy[].levelUpTime integer N Escalation duration time
scheduleStrategy[].strategy[].incidentsLevel array N Corresponding incident level list
scheduleStrategy[].strategy[].incidentsStatus array N Corresponding incident status open - unassigned working - in progress

scheduleStrategy field example:

  [
    {
        "uuid": "",
        "name": "AAA",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["watchkeeper"]
                    }
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            },
            {
                "level": 1,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"],
                        "notifyMethod": ["mobile", "message", "email"]
                    },
                    {
                        "notifyObjectType": "group",
                        "notifyObject": ["uuid_xxx2"],
                        "notifyMethod": ["mobile", "message", "email"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300,
                "levelUpTime": 1800,
                "incidentsLevel": ["uuid_xxxx"],
                "incidentsStatus": ["open"]
            }
        ]
    },
    {
        "uuid": "",
        "name": "BBB",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObject": "uuid_xxx"
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            }
        ]
    }
]

Request Example

curl 'https://openapi.truewatch.com/api/v1/incidents/schedule/incsch_xxx/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"test","timezone":"Asia/Shanghai","start":"00:00","end":"23:59","tagFilter":[],"dimensionFilter":"host:172.16.242.113","scheduleStrategy":[{"name":"test","uuid":"4c5851c0-f692-11f0-9ba3-87705656b525","strategy":[{"level":0,"notifyConfig":[{"notifyMethod":["email","message"],"notifyObject":["watchkeeper"],"notifyObjectType":"member"},{"notifyMethod":[],"notifyObject":["notify_xxx"],"notifyObjectType":"notify"}],"ifRepeatNotify":false,"repeatNotifyInterval":null},{"level":1,"levelUpTime":1800,"notifyConfig":[{"notifyMethod":["email"],"notifyObject":["acnt_xxxx"],"notifyObjectType":"member"}],"ifRepeatNotify":true,"incidentsLevel":["system_level_0"],"incidentsStatus":["open"],"repeatNotifyInterval":300}]}],"notifyTargets":["acnt_xxx"],"extend":{"enableRotateNotification":false,"rotationCycle":"day"}}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "workspaceUUID": "wksp_xxx",
        "name": "test",
        "timezone": "Asia/Shanghai",
        "start": "00:00",
        "end": "23:59",
        "tagFilter": [],
        "dimensionFilter": "host:172.16.242.113",
        "notifyTargets": [
            "acnt_xxx"
        ],
        "strategyConfig": [
            {
                "name": "test",
                "uuid": "4c5851c0-f692-11f0-9ba3-87705656b525",
                "strategy": [
                    {
                        "level": 0,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email",
                                    "message"
                                ],
                                "notifyObject": [
                                    "watchkeeper"
                                ],
                                "notifyObjectType": "member"
                            },
                            {
                                "notifyMethod": [],
                                "notifyObject": [
                                    "notify_xxx"
                                ],
                                "notifyObjectType": "notify"
                            }
                        ],
                        "ifRepeatNotify": false,
                        "repeatNotifyInterval": null
                    },
                    {
                        "level": 1,
                        "levelUpTime": 1800,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email"
                                ],
                                "notifyObject": [
                                    "acnt_xxx"
                                ],
                                "notifyObjectType": "member"
                            }
                        ],
                        "ifRepeatNotify": true,
                        "incidentsLevel": [
                            "system_level_0"
                        ],
                        "incidentsStatus": [
                            "open"
                        ],
                        "repeatNotifyInterval": 300
                    }
                ]
            }
        ],
        "extend": {
            "enableRotateNotification": false,
            "rotationCycle": "day"
        },
        "isDefault": false,
        "rotationUpdateAt": 1768989775,
        "id": 9180,
        "uuid": "incsch_xxx",
        "status": 0,
        "creator": "acnt_xxx",
        "updator": "acnt_xxx",
        "createAt": 1768964659,
        "deleteAt": -1,
        "updateAt": 1768989775
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "xxx"
}