Search code examples
icloudicalendarcaldav

iCloud calendar Delete Event Request not working with caldav


Iam using caldav-client-v2.php library to read calendar events from iCloud calendars,

GetEvents() function returns array of calendar data wich contains ics url and etag,which are passed to the DoDELETERequest(href,etag) for deleteing event, this is working for owncloud calendar, but when i try to do this for iCloud it is not deleting the event and returns the error as 'Wrong entity tag' the tag is something like this FT=-@RU=5c162550-1ccc-4821-80d6-e2fab587c348@S=1685

i tried passing 5c162550-1ccc-4821-80d6-e2fab587c348 to the function, but i get the same error. is the caldav server returns wrong etag or how can i get it worked ?


Solution

  • An ETag is defined to be a quoted string, see RFC 7232, section 2.3. It says:

    ETag       = entity-tag
    
    entity-tag = [ weak ] opaque-tag
    weak       = %x57.2F ; "W/", case-sensitive
    opaque-tag = DQUOTE *etagc DQUOTE
    etagc      = %x21 / %x23-7E / obs-text
               ; VCHAR except double quotes, plus obs-text
    

    That's also how you should have received the ETags from the server. Make sure you send the ETag exactly like you receive it. In particular, don't remove any quotes.

    So try passing "FT=-@RU=5c162550-1ccc-4821-80d6-e2fab587c348@S=1685" instead.