JSON-LD"活动预约"更新&消除

时间:2017-05-19 09:37:10

标签: email calendar json-ld google-schemas

我被要求在事件门户发送的EVENT RESERVATION电子邮件中实施JSON-LD标准,以自动添加,更新和取消用户日历中的事件。

我是按照Google https://developers.google.com/gmail/markup/reference/event-reservation#update_a_event

的说明进行操作的

我只是设法在用户收到预订电子邮件时自动添加活动,但是我很难找到如何实施更新和取消的方法。

对于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>
&#13;
&#13;
&#13;

我的日历中的结果是以下enter image description here

然后我尝试将此代码发送到UPDATE事件,但是我没有注意到日历中的任何更改。该活动仍处于同一日期。

&#13;
&#13;
<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>
&#13;
&#13;
&#13;

让您知道为什么代码直接来自Google的教程。不管用?我该如何实现这些功能呢?

1 个答案:

答案 0 :(得分:0)

首次添加活动时,您应尝试添加“modifiedTime”标记,因为它用作预订时间。

然后,Google会检测到,如果id相同且者ModifiedTime不同,则应该更新该事件。