Domain Shared Contacts API 會使用標準 Google Data API 元素,以及共用聯絡人專用的元素。
聯絡人項目格式為延伸聯絡種類,代表人員、場地 (例如俱樂部或餐廳) 或機構。聯絡人種類會以 <atom:entry>
元素的形式顯示在 XML 中,其中包含 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:email
gd:im
gd:organization
gd:phoneNumber
gd:structuredPostalAddress
當您建立或更新共用聯絡人時,如果您同時為任何元素提供 rel
和 label
(或兩者都提供),則伺服器會拒絕該項目。
Google 相簿支援
除了自行編輯或編輯等標準屬性的值,也可以使用 atom:link
元素的 rel
值。使用相片連結時,必須指定 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 。 |