2017-06-06 48 views
1

我正在創建一個新的聯繫人,如Google Contacts API中所述。具體來說,我做了POSThttps://www.google.com/m8/feeds/contacts/default/full。我的POST直接從Google Contacts API文檔中獲取,並且在下面複製。如何通過Google Contacts API創建新聯繫人?

問題是谷歌把新創建的聯繫人放在「其他聯繫人」下。也就是說,如果我在瀏覽器中打開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]" displayName="E. Bennet"/> 
    <gd:email rel="http://schemas.google.com/g/2005#home" 
    address="[email protected]"/> 
    <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]" 
    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> 

回答

2

首先,我建議確保您發送了包含標頭GData-Version:3.0的授權請求。

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

一個成功的請求將返回一個包含「我的聯繫人」的組列表。

使用「我的聯繫人」的groupId,您現在可以change the Group Membership of that contact

檢查this google forum瞭解更多信息。

相關問題