【问题标题】:Phantom Entry created in Google Shared Contacts在 Google 共享联系人中创建的虚拟条目
【发布时间】:2016-11-30 10:37:13
【问题描述】:

在针对 Google Contacts v3 API(范围 https://www.google.com/m8/feeds/)进行开发和测试时,我在我们公司的共享联系人列表(即目录文件夹)中创建了一个条目,该条目没有 ID,也无法点击(“联系人是'未找到”)。 因此我无法删除该条目。 请求“列出联系人”时也没有列出(totalResults:0)。

Google for Work 支持无法在此处提供帮助,建议您在此论坛中提问。 我希望有人知道如何摆脱那个幻影条目。

【问题讨论】:

    标签: google-api google-oauth google-shared-contacts google-admin-sdk


    【解决方案1】:

    正如预期的那样,删除必须由 Google 完成,而且我无法通过额外的 API 调用来完成。

    【讨论】:

      【解决方案2】:

      Shared Contacts API 允许客户端应用程序检索和更新与 Google Apps 域中的所有用户共享的外部联系人。 Apps 域的所有用户都可以看到共享的联系人,并且所有 Google 服务都可以访问联系人列表。

      创建要发布的共享联系人的 XML 表示。此 XML 需要采用 Contact 类型的 Atom 元素的形式,可能如下所示:

      <atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
      xmlns:gd='http://schemas.google.com/g/2005'>
      <atom:category scheme='http://schemas.google.com/g/2005#kind'
      term='http://schemas.google.com/contact/2008#contact' />
      <gd:name>
      <gd:givenName>Elizabeth</gd:givenName>
      <gd:familyName>Bennet</gd:familyName>
      <gd:fullName>Elizabeth Bennet</gd:fullName>
      </gd:name>
      <atom:content type='text'>Notes</atom:content>
      <gd:email rel='http://schemas.google.com/g/2005#work'
      primary='true'
      address='liz@gmail.com' displayName='E. Bennet' />
      <gd:email rel='http://schemas.google.com/g/2005#home'
      address='liz@example.org' />
      <gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
      primary='true'>
      (206)555-1212
      </gd:phoneNumber>
      <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
      (206)555-1213
      </gd:phoneNumber>
      <gd:im address='liz@gmail.com'
      protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
      primary='true'
      rel='http://schemas.google.com/g/2005#home' />
      <gd:structuredPostalAddress
      rel='http://schemas.google.com/g/2005#work'
      primary='true'>
      <gd:city>Mountain View</gd:city>
      <gd:street>1600 Amphitheatre Pkwy</gd:street>
      <gd:region>CA</gd:region>
      <gd:postcode>94043</gd:postcode>
      <gd:country>United States</gd:country>
      <gd:formattedAddress>
      1600 Amphitheatre Pkwy Mountain View
      </gd:formattedAddress>
      </gd:structuredPostalAddress>
      
      </atom:entry>
      
      https://www.google.com/m8/feeds/contacts/example.com/full
      

      Google 服务器使用您发送的条目创建一个联系人,然后返回一个HTTP 201 CREATED 状态代码,以及一个&lt;entry&gt; 元素形式的新联系人副本。

      您的客户端应用程序可以使用共享联系人 API 来创建新的共享联系人、编辑或删除现有的共享联系人以及查询符合特定条件的共享联系人。

      要删除联系人,请向联系人的编辑 URL 发送授权的 DELETE 请求。

      网址格式为:

      https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
      

      用适当的值代替 userEmailcontactID

      注意:特殊的 userEmail 值默认值可用于引用经过身份验证的用户。

      为确保发送到 API 的请求不会覆盖其他客户端的更改,应在请求标头中提供联系人条目的 Etag

      If-Match: Etag
      

      如果Etag 已过时,服务器会以HTTP 412 Precondition Failed 状态码进行响应。

      <!-- Request -->
      DELETE /m8/feeds/contacts/default/full/contactId
      If-match: Etag
      ...
      <!-- Response -->
      HTTP/1.1 200 OK
      

      【讨论】:

      • 嗯,我知道所有这些步骤,通常它们可以正常工作。在这种情况下,提到的联系人没有 ID!它只是显示在 Directory 文件夹的列表中,但不能像普通的联系人条目那样被删除。
      猜你喜欢
      • 2013-06-10
      • 2012-07-07
      • 2015-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-22
      • 2015-10-15
      相关资源
      最近更新 更多