3 ms·
Ask HN: Best API format for recurring schedules?
I'm trying to develop a standard by which people can submit recurring schedules for things like thermostats and access codes for smart locks for seam.co. I couldn't find any standard for recurring schedules other than the iCalendar format, which seems a bit unwieldy for a JSON API.
Cron is a bit limited, e.g. doesn't represent ranges of time.
This seems like a really common problem, anybody solving this in their work today?
- mooreds 4y agoI'd probably start with google calendar's docs. Looks like it has a decent API for this: https://developers.google.com/calendar/api/guides/recurringevents https://developers.google.com/calendar/api/guides/recurringe... Edit: also this: https://developers.google.com/calendar/api/v3/reference/events https://developers.google.com/calendar/api/v3/reference/even...
- seveibar 4y agoThe first link looks like a good translation of the iCalendar to JSON, I guess you can't really beat the iCalendar standard when it comes to representing events!
- jayknight 4y agoMany years ago, I built a calendaring system and I ended up implementing iCalendar but in a database instead of a file. I would not recommend doing it the way I did, but I did come to the conclusion that if you want to support the same types of recurrences, you really should be very familiar with how icalendar handles things or you'll forget something important.
- throwaway888abc 4y agoI would use "recurrence rules", but curious to hear more. https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-... https://jakubroztocil.github.io/rrule/ https://jakubroztocil.github.io/rrule/ https://github.com/jakubroztocil/rrule https://github.com/jakubroztocil/rrule All best with your project
- seveibar 4y agoThose libraries are helpful thanks! I didn't know icalendar had an RFC, very helpful!