取得共用聯絡人

您可以透過下列方式要求共用使用者聯絡人:

  • 所有共用聯絡人
  • 符合指定條件的一組聯絡人
  • 單一共用聯絡人
  • 聯絡人相片

根據預設,動態消息中的項目不會排序。

取得所有共用聯絡人

  1. 如要取得所有共用聯絡人,請向聯絡人動態消息網址傳送 HTTP GET 要求:

    GET https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION

    更改下列內容:

    • DOMAIN:您的網域。例如 example.com。
    • PROJECTION:預測值。如需支援的值,請參閱「投影值」。

    伺服器會傳回 HTTP 200 OK 狀態碼和 Atom 1.0 動態消息。 以下範例顯示含有一個項目的聯絡人動態饋給:

    <feed xmlns='http://www.w3.org/2005/Atom'
        xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
        xmlns:gd='http://schemas.google.com/g/2005'
        xmlns:gContact='http://schemas.google.com/contact/2008'
        xmlns:batch='http://schemas.google.com/gdata/batch'>
      <id>https://www.google.com/m8/feeds/contacts/example.com/base</id>
      <updated>2008-03-05T12:36:38.836Z</updated>
      <category scheme='http://schemas.google.com/g/2005#kind'
        term='http://schemas.google.com/contact/2008#contact' />
      <title type='text'>example.com's Contacts</title>
      <link rel='http://schemas.google.com/g/2005#feed'
        type='application/atom+xml'
        href='https://www.google.com/m8/feeds/contacts/example.com/full' />
      <link rel='http://schemas.google.com/g/2005#post'
        type='application/atom+xml'
        href='https://www.google.com/m8/feeds/contacts/example.com/full' />
      <link rel='http://schemas.google.com/g/2005#batch'
        type='application/atom+xml'
        href='https://www.google.com/m8/feeds/contacts/example.com/full/batch' />
      <link rel='self' type='application/atom+xml'
        href='https://www.google.com/m8/feeds/contacts/example.com/full?max-results=25' />
      <author>
        <name>example.com</name>
        <email>example.com</email>
      </author>
      <generator version='1.0' uri='https://www.google.com/m8/feeds/contacts'>
        Contacts
      </generator>
      <openSearch:totalResults>1</openSearch:totalResults>
      <openSearch:startIndex>1</openSearch:startIndex>
      <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
      <entry>
        <id>
          https://www.google.com/m8/feeds/contacts/example.com/base/c9012de
        </id>
        <updated>2008-03-05T12:36:38.835Z</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>
        <link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*"
          href="http://google.com/m8/feeds/photos/media/example.com/c9012de"/>
        <link rel='self' type='application/atom+xml'
          href='https://www.google.com/m8/feeds/contacts/example.com/full/c9012de' />
        <link rel='edit' type='application/atom+xml'
          href='https://www.google.com/m8/feeds/contacts/example.com/full/c9012de/1204720598835000' />
        <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'
          primary='true'>
          456
        </gd:phoneNumber>
        <gd:extendedProperty name="pet" value="hamster" />
      </entry>
    </feed>
  2. 動態消息單一回應的大小上限為 10 MB。如要取得完整清單,請在傳回的動態消息中重複點選「下一步」連結。

使用查詢參數取得共用聯絡人

要求符合指定條件的聯絡人,例如在特定日期後更新的聯絡人。不支援全文查詢和電子郵件地址查詢。 如需所有查詢參數,請參閱「Domain Shared Contacts API 參考指南」。

  1. 使用參數將 HTTP GET 要求傳送至聯絡人動態消息網址:

    GET https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION?PARAMETER

    更改下列內容:

    舉例來說,如要取得 example.com 在 2022 年 3 月 16 日後更新的項目,請新增 updated-min 參數:

    GET https://www.google.com/m8/feeds/contacts/example.com/full?updated-min=2022-03-16T00:00:00
    

    伺服器會傳回 HTTP 200 OK 狀態碼,以及含有所有相符項目的動態消息。

  2. 動態消息單一回應的大小上限為 10 MB。如要取得完整清單,請在傳回的動態消息中,重複點選「下一步」連結。

追蹤增量變更

如要追蹤網域共用聯絡人清單的變更: 1. 記錄動態饋給 <updated> 元素的值。 1. 將 updated-min 設為該 <updated> 值,並將 showdeleted 設為 true,即可要求變更的聯絡人。

取得單一共用聯絡人

如要取得特定聯絡人,請使用聯絡人的自我連結,該連結位於共用聯絡人動態消息中。詳情請參閱「取得所有共用聯絡人」。

  1. 如要取得特定聯絡人,請傳送 HTTP GET 要求給該聯絡人的自我連結:
    GET https://www.google.com/m8/feeds/contacts/DOMAIN/PROJECTION/SELF_LINK
    請替換下列項目:
  • DOMAIN:您的網域,例如 example.com。
  • PROJECTION:預測值。如需支援的值,請參閱「投影值」。
  • SELF_LINK:聯絡人的專屬數值。

伺服器會傳回 HTTP 200 OK 狀態碼和聯絡人項目。

舉例來說,如要取得含有自我連結的聯絡人,請執行下列操作: https://www.google.com/m8/feeds/contacts/example.com/full/12345

GET https://www.google.com/m8/feeds/contacts/example.com/full/12345

後續步驟