共有の連絡先を取得する

共有ユーザーの連絡先は、次の方法でリクエストします。

  • すべての共有連絡先
  • 指定した条件に一致する連絡先のセット
  • 単一の共有連絡先
  • 連絡先の写真

デフォルトでは、フィード内のエントリは順序付けされていません。

すべての共有連絡先を取得する

  1. 共有連絡先をすべて取得するには、連絡先フィードの URL に HTTP GET リクエストを送信します。

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

    次のように置き換えます。

    • DOMAIN: ドメイン。(例: example.com)。
    • PROJECTION: 投影値。サポートされている値については、プロジェクション値をご覧ください。

    サーバーは HTTP 200 OK ステータス コードと Atom 1.0 フィードを返します。次の例は、1 つのエントリを含む連絡先フィードを示しています。

    <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. フィードは 1 回のレスポンスで最大 10 MB を返します。リスト全体を取得するには、返されたフィードの [次へ] リンクを繰り返しクリックします。

クエリ パラメータを使用して共有連絡先を取得する

特定の日付以降に更新された連絡先など、指定された条件に一致する連絡先をリクエストします。全文検索クエリとメールアドレスの検索はサポートされていません。すべてのクエリ パラメータについては、Domain Shared Contacts API リファレンス ガイドをご覧ください。

  1. パラメータを指定して、連絡先フィード URL に 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. フィードは 1 回のレスポンスで最大 10 MB を返します。リスト全体を取得するには、返されたフィードの [次へ] リンクを繰り返しクリックします。

増分変更を追跡する

ドメイン共有の連絡先リストの変更を追跡するには: 1. フィードの <updated> 要素の値を記録します。1. updated-min をその <updated> 値に設定し、showdeletedtrue に設定して、変更された連絡先をリクエストします。

単一の共有連絡先を取得する

特定の連絡先を取得するには、共有連絡先フィードで確認できる連絡先のセルフリンクを使用します。詳細については、共有の連絡先をすべて取得するをご覧ください。

  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

次のステップ