Synology Calendar API - List events
Request Synology Calendar API to list events. Define the specific calendars and time period.
Check the Synology API Collection for related examples.
[{"id":"4f0ac7db60d704b0","type":"group","z":"55979001e6fb4b69","name":"","style":{"fill-opacity":"0.2","label":true},"nodes":["91ae0c63a47180ce","d4f2c52f4bb9a1b1","14d2e03f922d3590","302257e7fa000adc","1373388960a892f6"],"x":34,"y":39,"w":752,"h":142},{"id":"91ae0c63a47180ce","type":"comment","z":"55979001e6fb4b69","g":"4f0ac7db60d704b0","name":"List events","info":"","x":120,"y":80,"wires":[]},{"id":"d4f2c52f4bb9a1b1","type":"debug","z":"55979001e6fb4b69","g":"4f0ac7db60d704b0","name":"response","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":140,"wires":[]},{"id":"14d2e03f922d3590","type":"http request","z":"55979001e6fb4b69","g":"4f0ac7db60d704b0","name":"","method":"use","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":140,"wires":[["d4f2c52f4bb9a1b1"]]},{"id":"302257e7fa000adc","type":"function","z":"55979001e6fb4b69","g":"4f0ac7db60d704b0","name":"list events","func":"msg.method = \"GET\";\nmsg.url = flow.get(\"synoentryurl\");\nmsg.cookies = { id: flow.get(\"sid\") };\nmsg.headers = { 'X-SYNO-TOKEN': flow.get(\"synotoken\") };\n\n// select all calendars\nvar calendars = flow.get('calendars') || [];\nconst cal_id = JSON.stringify(calendars.map(cal => cal.cal_id));\n// select 7 days ahead\nconst daysahead = 7;\n\nmsg.payload = {\n api: \"SYNO.Cal.Event\",\n method: \"list\",\n version: 5,\n cal_id_list: cal_id,\n start: Math.floor((new Date()).getTime()/1000),\n end: Math.floor((new Date()).getTime() / 1000) + 60*60*24*daysahead, \n};\n\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":140,"wires":[["14d2e03f922d3590"]]},{"id":"1373388960a892f6","type":"inject","z":"55979001e6fb4b69","g":"4f0ac7db60d704b0","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":140,"wires":[["302257e7fa000adc"]]}]