Domain Shared Contacts API 使用標準 Google Data API 元素,以及共用聯絡人專用的元素。
聯絡人項目會採用擴充的聯絡人類型,代表個人、場地 (例如俱樂部或餐廳) 或機構。聯絡人種類在 XML 中會顯示為 <atom:entry> 元素,其中包含 Google 資料命名空間的各種擴充元素。
表示項目為聯絡人的 category 元素如下所示:
<atom:category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/contact/2008#contact"/>
在 Domain Shared Contacts API 中,有幾個元素的限制比聯絡人種類略為嚴格。對於下列元素,您要提供 rel 屬性或 label 屬性,但不得同時提供兩者:
gd:emailgd:imgd:organizationgd:phoneNumbergd:structuredPostalAddress
建立或更新共用聯絡人時,如果為任何元素提供 rel 和 label,或兩者皆未提供,伺服器就會拒絕該項目。
相片支援
除了 self 或 edit 等標準屬性的值,您也可以使用 rel 元素的值。atom:link使用相片連結時,必須在 HTTP 標頭中指定授權權杖。詳情請參閱「瞭解驗證和授權」。
- 使用
GET指令,rel="http://schemas.google.com/contacts/2008/rel#photo"即可新增讀取與聯絡人相關聯相片的功能。您可以透過href中指定的網址,讀取與聯絡人相關聯的最新版相片。如果聯絡人沒有圖片,就不會顯示連結。
範例:
<atom:link rel="http://schemas.google.com/contacts/2008/rel#photo"
href="https://www.google.com/m8/feeds/photos/media/jo%40example.com/1234" type="image/*" />
- 使用
PUT或DELETE指令,rel="http://schemas.google.com/contacts/2008/rel#edit-photo"即可更新或刪除與聯絡人相關聯的本機相片。
範例:
<atom:link rel="http://schemas.google.com/contacts/2008/rel#edit-photo"
href="https://www.google.com/m8/feeds/photos/media/jo%40example.com/1234/photo4524" />
gContact 命名空間
gContact 的 XML 命名空間網址為 http://schemas.google.com/contact/2008。
這個命名空間中定義的元素代表聯絡人所屬的群組。
gContact:groupMembershipInfo 個房源
| 屬性 | 說明 |
|---|---|
href |
識別聯絡人所屬或曾所屬的群組。群組會以 ID 參照。 |
deleted="true" |
表示該聯絡人已從群組中移除。只有在 showdeleted 指定為查詢參數時,才會納入這項屬性,否則系統不會傳回聯絡人不再屬於的群組 groupMembershipInfo。 |