Skip to content

Create



POST /api/v1/notification_schedule/add

Overview

Create a schedule

Body Request Parameters

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

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
notifyTargets array Required Notification targets, includes account uuid, notification target uuid, email
extend Json Extended information

2. **extend Parameter Description

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 this schedule is permanently effective, start/end time is 11-digit timestamp

Request Example

curl 'https://openapi.truewatch.com/api/v1/notification_schedule/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"schecule_add","timezone":"Asia/Shanghai","start":"00:00","end":"23:59","notifyTargets":["acnt_8b4bd2b8782646f3ba8f6554193f5997","notify_1c08db8458ba4ecabd27b8ce805e8502"],"extend":{"enableRotateNotification":true,"rotationCycle":"workDay","effectiveTime":{"start":1735747200,"end":1737603472}}}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "createAt": 1735797896,
        "creator": "wsak_f2ba9858f4414655be39efc882b120dd",
        "declaration": {},
        "deleteAt": -1,
        "effectiveTimeInfos": {
            "expired": false,
            "timeStr": "2025/01/02 00:00:00~2025/01/23 11:37:52"
        },
        "end": "23:59",
        "extend": {
            "effectiveTime": {
                "end": 1737603472,
                "start": 1735747200
            },
            "enableRotateNotification": true,
            "rotationCycle": "workDay"
        },
        "id": null,
        "name": "schecule_add",
        "notifyTargets": [
            "acnt_8b4bd2b8782646f3ba8f6554193f5997",
            "notify_1c08db8458ba4ecabd27b8ce805e8502"
        ],
        "rotationUpdateAt": 1735797896,
        "start": "00:00",
        "status": 0,
        "timezone": "Asia/Shanghai",
        "updateAt": null,
        "updator": null,
        "uuid": "nsche_3512c1f4d176433484676225b547ef7a",
        "workspaceUUID": "wksp_798c5e0f589e4992994196832f64b6ba"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-2655C615-0DA5-4391-8528-E46D1783B3F6"
}