Manage Synology Calendar using the official Calendar API.
Documentation: Calendar_API_Guide_enu.pdf
export SYNOLOGY_URL="http://{nas_ip}:5000" # 內網地址
export SYNOLOGY_USER="{username}"
export SYNOLOGY_PASSWORD="your-password"
from client import SynologyCalendar
cal = SynologyCalendar()
cal.login()
# List calendars
calendars = cal.get_calendars()
for c in calendars:
print(f"{c['cal_id']}: {c['cal_displayname']}")
cal.logout()
| Method | Description | Status |
|---|---|---|
get_calendars() |
List all calendars | ✅ Working |
get_calendar(cal_id) |
Get calendar details | ✅ Working |
create_calendar(...) |
Create calendar | ✅ Working |
delete_calendar(cal_id) |
Delete calendar | ✅ Working |
| Method | Description | Status |
|---|---|---|
list_events(cal_id_list) |
List events | ✅ Working |
get_event(evt_id) |
Get event details | ✅ Working |
create_event(...) |
Create event | ✅ Working |
delete_event(evt_id) |
Delete event | ✅ Working |
Event Creation Notes:
✅ Working:
⚠️ Critical: SID must be in URL parameter, not JSON body
The Synology Calendar v1 API requires the _sid parameter in the URL query string, not in the JSON body.
create_event Parameters:
| Parameter | Type | Required | Example |
|---|---|---|---|
| cal_id | string | ✅ | /admin/home/ |
| summary | string | ✅ | Event title |
| dtstart | int | ✅ | 1770440000 |
| dtend | int | ✅ | 1770443600 |
| is_all_day | bool | ✅ | false |
| is_repeat_evt | bool | ✅ | false |
| color | string | ✅ | #D9AE00 |
| description | string | ✅ | Description |
| notify_setting | array | ✅ | [] |
| participant | array | ✅ | [] |
| timezone | string | (if not all-day) | Asia/Shanghai |
Example:
# Non-all-day event (working)
cal.create_event(
cal_id='/{username}/home/',
summary='Meeting',
dtstart=now,
dtend=now + 3600,
is_all_day=False,
is_repeat_evt=False,
description='Team meeting',
color='#D9AE00',
timezone='Asia/Shanghai'
)
| Method | Description | Status |
|---|---|---|
create_todo(...) |
Create task | ✅ Working |
list_todos(...) |
List tasks | ✅ Working |
get_todo(evt_id) |
Get task details | ✅ Working |
delete_todo(evt_id) |
Delete task | ✅ Working |
complete_todo(evt_id) |
Mark complete | ✅ Working |
| Method | Description | Status |
|---|---|---|
list_contacts() |
List participants | ✅ Working |
# Login python client.py login # List calendars python client.py list-calendars # List todos python client.py list-todos --cal-id "/{username}/home_todo/" # Create todo python client.py create-todo \ --cal-id "/{username}/home_todo/" \ --title "Task name" # Complete todo python client.py complete-todo --evt-id "1012"7w4.net小蔥技能站收錄全網優質技能,值得收藏。
Previous Issue: Event creation returned error 9009 due to:
original_cal_id parameterSolution: Use v1 API with:
cal_id from get_calendars() responseoriginal_cal_id = cal_id (for non-shared calendars)?_sid=xxx| ID | Name | Type |
|---|---|---|
/{username}/home/ |
My Calendar | event |
/{username}/home_todo/ |
Inbox | todo |
這個 Skill 質量中等偏上,基本能用,但存在一些問題。它能幫你管理 Synology 日曆上的事件和任務,功能覆蓋面還行,文件也比較詳細。不過文件裡的引數說明和實際程式碼有時候對不上,任務完成等部分功能的程式碼實現不完整,可能導致某些操作無法正常工作。如果你是 Synology NAS 使用者且需要用程式碼管理日曆,可以用,但需要仔細核對引數用法。