如何通过Google Contacts API创建新联系人? [英] How to create a new contact via Google Contacts API?
问题描述
我正在按照 Google联系人API 中的说明创建新联系人. .具体来说,我对https://www.google.com/m8/feeds/contacts/default/full
做了POST
.我POST
的内容直接来自Google Contacts API文档,并且也复制到下面.
I am creating a new contact as described in Google Contacts API . Specifically, I do a POST
to https://www.google.com/m8/feeds/contacts/default/full
. The content that I POST
is taken directly from Google Contacts API document and also copied below.
问题是Google将新创建的联系人放在其他联系人"下.就是说,如果我在浏览器中打开 https://contacts.google.com/,则新联系人为未显示.我必须转到左侧的侧边栏,单击更多",然后单击其他联系人".
The problem is Google puts the newly created contact under "Other Contacts". That is if I open https://contacts.google.com/ in the browser, the new contact is not shown. I have to go to the sidebar in the left, click "More" and then click "Other Contacts".
如何以编程方式创建联系人,以便可以直接在 https://contacts.google上看到它. com/而不转到其他联系人"?
How can I create a contact programmatically, so that I can see it directly in https://contacts.google.com/ without going to "Other Contacts"?
<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>
推荐答案
首先,我建议确保您发送的授权请求的标头为GData-Version:3.0.
First, I recommend making sure that you sent an authorized request with the header GData-Version: 3.0 included.
https://www.google.com/m8/feeds/groups/default/full
成功的请求将返回一个组列表,其中包括我的联系人".
A successful request will return a list of groups, 'My Contacts' included.
使用我的联系人"的groupId,您现在可以更改该联系人的组成员身份.
Using the groupId of 'My Contacts', you can now change the Group Membership of that contact.
检查此Google论坛以获取更多信息
这篇关于如何通过Google Contacts API创建新联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!