简体   繁体   English

JSON-LD“事件保留”的更新和取消

[英]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. 我被要求在从事件门户发送的EVENT RESERVATION电子邮件中实施JSON-LD标准,以便从用户日历中自动添加,更新和取消事件。

I'm following this tutorial from Google https://developers.google.com/gmail/markup/reference/event-reservation#update_a_event 我正在从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 对于ADD事件,我正在使用此代码

 <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. 然后,我尝试将此代码发送给UPDATE事件,但是我没有注意到日历中的任何更改。 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. 您知道为什么直接从Google教程中获取代码的原因。 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. 首次添加事件时,您应尝试添加“ modifiedTime”标签,因为它充当预订时间。

Google then detects that, if the id is the same and the modifiedTime is different, the event should be updated. 然后,Google会检测到,如果ID相同且ModifyedTime不同,则应更新事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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