如何通过 Google Contacts API 创建新联系人?

2024-01-17

我正在创建一个新联系人,如中所述谷歌通讯录 API https://developers.google.com/google-apps/contacts/v3/。具体来说,我做了一个POST to https://www.google.com/m8/feeds/contacts/default/full。我所讲的内容POST直接取自 Google Contacts API 文档,也复制如下。

问题是 Google 将新创建的联系人放在“其他联系人”下。也就是说如果我打开https://contacts.google.com/ https://contacts.google.com/在浏览器中,不会显示新联系人。我必须转到左侧边栏,单击“更多”,然后单击“其他联系人”。

如何以编程方式创建联系人,以便我可以直接在https://contacts.google.com/ https://contacts.google.com/不去“其他联系人”?

<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="[email protected] /cdn-cgi/l/email-protection" displayName="E. Bennet"/>
  <gd:email rel="http://schemas.google.com/g/2005#home"
    address="[email protected] /cdn-cgi/l/email-protection"/>
  <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="[email protected] /cdn-cgi/l/email-protection"
    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>

首先,我建议确保您发送了包含标头 GData-Version: 3.0 的授权请求。

https://www.google.com/m8/feeds/groups/default/full

成功的请求将返回组列表,其中包括“我的联系人”。

使用“我的联系人”的 groupId,您现在可以更改该联系人的组成员身份 https://developers.google.com/google-apps/contacts/v3/#changing_group_membership.

Check 这个谷歌论坛 https://groups.google.com/forum/#!topic/google-contacts-api/GMWkbSi8vz0了解更多信息。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何通过 Google Contacts API 创建新联系人? 的相关文章

随机推荐