Error on creating a grant that has multiple events within ical

Viewed 63

I am using tapkey_management_api_v1 and I need to create a grant that has recurring events for each week days. but I got an error. Is it possible to add events for each day of week?

{
  "ErrorCode": "TimeRestrictionIcalTooComplex",
  "ErrorMessage": "encoded ical too long",
  "ErrorDetails": null,
  "UserErrorMessage": null
}

the ical was,

BEGIN:VCALENDAR
VERSION:2.0
PRODID:www.test-app.test
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:35a14f06-cd63-4185-b456-d872656abc7d
DTSTART:20211018T000000Z
DTEND:20211018T050000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=MO
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:dc02d22c-73d8-4d6f-abab-81247daeec2a
DTSTART:20211019T000000Z
DTEND:20211019T100000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=TU
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:618a67aa-5a35-4b9d-a735-8e8c0d83f84c
DTSTART:20211020T000000Z
DTEND:20211020T150000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=WE
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:67f7865b-3075-40d2-a788-c969d01ff01d
DTSTART:20211021T000000Z
DTEND:20211021T200000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=TH
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:e43a9a09-477b-4e0e-92eb-4a6d63ed1064
DTSTART:20211022T000000Z
DTEND:20211022T201500Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=FR
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:05399c67-fae3-4529-b6f3-afd0e8ea2cbc
DTSTART:20211023T000000Z
DTEND:20211023T203000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=SA
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20211018T190000Z
UID:50b23e9f-5e2e-470a-b83c-96af65c46199
DTSTART:20211024T000000Z
DTEND:20211025T000000Z
RRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=SU
END:VEVENT
END:VCALENDAR

curl request

curl -X "PUT" "https://my.tapkey.com/api/v1/owners/xxxx/grants" \
     -H 'Authorization: Bearer xxxx' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "timeRestrictionIcal": "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:www.test-app.test\nCALSCALE:GREGORIAN\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:35a14f06-cd63-4185-b456-d872656abc7d\nDTSTART:20211018T000000Z\nDTEND:20211018T050000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=MO\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:dc02d22c-73d8-4d6f-abab-81247daeec2a\nDTSTART:20211019T000000Z\nDTEND:20211019T100000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=TU\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:618a67aa-5a35-4b9d-a735-8e8c0d83f84c\nDTSTART:20211020T000000Z\nDTEND:20211020T150000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=WE\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:67f7865b-3075-40d2-a788-c969d01ff01d\nDTSTART:20211021T000000Z\nDTEND:20211021T200000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=TH\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:e43a9a09-477b-4e0e-92eb-4a6d63ed1064\nDTSTART:20211022T000000Z\nDTEND:20211022T201500Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=FR\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:05399c67-fae3-4529-b6f3-afd0e8ea2cbc\nDTSTART:20211023T000000Z\nDTEND:20211023T203000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=SA\nEND:VEVENT\nBEGIN:VEVENT\nDTSTAMP:20211018T190000Z\nUID:50b23e9f-5e2e-470a-b83c-96af65c46199\nDTSTART:20211024T000000Z\nDTEND:20211025T000000Z\nRRULE:FREQ=WEEKLY;UNTIL=20220404T140000Z;BYDAY=SU\nEND:VEVENT\nEND:VCALENDAR",
  "boundLockId": "xxxx",
  "contactId": "xxxx",
  "active": true
}' | jq

According to the document about creating a grant, it says that

The calendar passed to Tapkey can contain one or multiple events. Events can hold recurrence rules as specified in RFC 5545, section 3.8.5.3..

And

The ICAL will be evaluated on the lock, where memory and computing power are limited. When a grant is created, the Tapkey Trust Service checks whether the affected locks will be able to process the specified ICAL. If that is not the case, the operation returns TimeRestrictionIcalTooComplex.

1 Answers

Unfortunately the number of RRULES that may be included in a single Grant’s ICAL is limited to 5 as of today. This usually isn’t a relevant restriction, as it happens quite rarely that users have different access times granted for every day. Btw. your ICAL doesn’t specify any time zone so far. Doing so would further reduce the number of RRULES available in a single ICAL.

Possible workarounds (though not applicable to this specific ICAL):

  • Try to combine multiple RRULEs to a lower number of RRULEs (i.e. by specifying multiple weekdays in a single RRULE).
  • Use RDATEs instead of RRULEs in case of low numbers of recurrences.
  • Instead of specifying an UNTIL date for every RRULE, specify a validBefore value for the whole Grant.
  • In cases where the VEVENTs don’t overlap (i.e. DTSTART – UNTIL don’t overlap), it would be possible to create multiple Grants each having a less complex ICAL.
Related