Domain Shared Contacts API 會使用 標準 Google Data API 元素,以及專門用於共用聯絡人的元素。
聯絡項目的形式為擴充的聯絡人類型,代表人物、地點 (例如俱樂部或餐廳) 或機構。聯絡人類型會以 <atom:entry>
元素的形式顯示在 XML 中,其中包含 Google Data 命名空間的各種擴充元素。
表示項目為聯絡人的 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 相簿支援
您可以將 rel
值與 self 或 edit 等標準資源的值搭配使用,用於 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 。 |