简体   繁体   中英

JSON-LD “Event reservation” update & cancellation

I was required to implement the JSON-LD standard in EVENT RESERVATION email sent from an event portal to automatically add, update and cancel an event from the user's calendar.

I'm following this tutorial from Google https://developers.google.com/gmail/markup/reference/event-reservation#update_a_event

I've only managed to automatically add an event whenever the user receive the booking email, however I'm struggling to find a way how to implement the update and cancellation.

For the ADD event I'm using this code

 <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "EventReservation", "reservationNumber": "E123456789", "reservationStatus": "http://schema.org/Confirmed", "underName": { "@type": "Person", "name": "John Smith" }, "reservationFor": { "@type": "Event", "name": "Foo Fighters Concert", "startDate": "2017-03-06T19:30:00-08:00", "location": { "@type": "Place", "name": "AT&T Park", "address": { "@type": "PostalAddress", "streetAddress": "24 Willie Mays Plaza", "addressLocality": "San Francisco", "addressRegion": "CA", "postalCode": "94107", "addressCountry": "US" } } } } </script> 

The result in my calendar is the following 在此处输入图片说明

Then I try to send this code to UPDATE the event, however I do not notice any changes in the calendar. The event is still in the same date.

 <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "EventReservation", "reservationNumber": "E123456789", "reservationStatus": "http://schema.org/Confirmed", "underName": { "@type": "Person", "name": "John Smith" }, "reservationFor": { "@type": "Event", "name": "Foo Fighters Concert", "startDate": "2017-03-06T20:00:00-08:00", "location": { "@type": "Place", "name": "AT&T Park", "address": { "@type": "PostalAddress", "streetAddress": "24 Willie Mays Plaza", "addressLocality": "San Francisco", "addressRegion": "CA", "postalCode": "94107", "addressCountry": "US" } } }, "modifiedTime": "2013-05-01T08:00:00-08:00" } </script> 

Have you an idea why the code, taken directly from the google's tutorial. is not working? And how can I implement those functionalities?

You should try to add the "modifiedTime" tag when you add the event the first time, as it serves as the booking time.

Google then detects that, if the id is the same and the modifiedTime is different, the event should be updated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM