更新和刪除共用聯絡人的方式類似,因為兩者都使用聯絡人的編輯網址。
更新共用聯絡人
更新項目時,請保留從伺服器擷取的所有 XML。 否則系統會刪除遭忽略的元素。更新最多可能需要 24 小時,才會反映在自動完成功能和聯絡人管理工具中。
如要更新現有的共用聯絡人:
- 取得要更新的項目。
- 編輯項目。
使用更新後的項目,對聯絡人的編輯網址傳送
PUT要求。 使用application/atom+xml內容類型,並確保<id>值與現有項目完全一致。編輯網址結尾會加上版本號碼,以偵測衝突。詳情請參閱「版本管理」。更新項目:
<entry> <id>https://www.google.com/m8/feeds/contacts/DOMAIN/base/8411573</id> <updated>2008-02-28T18:47:02.303Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' /> <title type='text'>TITLE_NAME</title> <gd:name> <gd:fullName>FIRST_NAME LAST_NAME</gd:fullName> </gd:name> <content type='text'>NOTES</content> <link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573' /> <link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/8411573/1204224422303000' /> <gd:phoneNumber rel='http://schemas.google.com/g/2005#other' primary='true'>PRIMARY_PHONE_NUMBER</gd:phoneNumber> <gd:extendedProperty name="CUSTOM_PROPERTY" value="CUSTOM_PROPRTY_VALUE" /> </entry>
更改下列內容:
DOMAIN:您的網域,例如 example.com。TITLE_NAME:項目的名稱,例如 example.com 聯絡人清單。FIRST_NAME:聯絡人的名字。LAST_NAME:聯絡人的姓氏。PROJECTION:預測值。如需支援的值,請參閱「投影值」。PRIMARY_PHONE_NUMBER:偏好的電話號碼。CUSTOM_PROPERTY:自訂屬性的名稱。CUSTOM_PROPRTY_VALUE:自訂屬性的值。以下是更新後的項目範例,並以方框特別標出編輯網址:
<entry> <id>https://www.google.com/m8/feeds/contacts/example.com/base/8411573</id> <updated>2008-02-28T18:47:02.303Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' /> <title type='text'>Fitzgerald</title> <gd:name> <gd:fullName>Fitzgerald</gd:fullName> </gd:name> <content type='text'>Notes</content> <link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573' /> <link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/example.com/full/8411573/1204224422303000' /> <gd:phoneNumber rel='http://schemas.google.com/g/2005#other' primary='true'>456-123-2133</gd:phoneNumber> <gd:extendedProperty name="pet" value="hamster" /> <gd:extendedProperty name="cuisine"> <italian /> </gd:extendedProperty> </entry>
刪除共用聯絡人
刪除的聯絡人最多可能需要 24 小時,才會從自動完成功能和聯絡人管理工具中消失。請勿透過刪除並重新新增聯絡人來更新聯絡人。請改為參閱「更新聯絡人」。
- 如要刪除共用聯絡人,請將
DELETE要求傳送至聯絡人的編輯網址。這個網址與更新聯絡人時使用的網址相同。
Google 會保留已刪除聯絡人的預留位置 30 天。請使用 showdeleted 查詢參數要求這些欄位。