CardDAV プロトコルで連絡先を管理する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google の CardDAV プロトコルを使用して、連絡先を表示、管理できます。
連絡先はユーザーの Google アカウントに保存されます。ほとんどの Google サービスは、
アクセスできるようになります。クライアント アプリケーションで CardDAV API を使用して、
新しい連絡先の作成、既存の連絡先の編集または削除、連絡先の検索
フィルタすることもできます
仕様
仕様全体は実装されていませんが、Apple iOS™ の連絡先や macOS など、多くのクライアントは正しく相互運用する必要があります。
関連する各仕様について、Google の CardDAV サポートは次のとおりです。
Google の CardDAV には OAuth 2.0 が必要です
Google の CardDAV インターフェースには OAuth 2.0 が必要です。OAuth 2.0 を使用して Google API にアクセスする方法については、以下のドキュメントをご覧ください。
Google の CardDAV サーバーに接続する
CardDAV プロトコルにより、アドレス帳や連絡先リソースを検出可能
URI などです。URI は随時変更される可能性があるため、ハードコードしないでください。
クライアント アプリケーションで HTTPS を使用し、OAuth 2.0
認証を
ユーザー ID 情報です。CardDAV サーバーは
リクエストが OAuth 2.0 で HTTPS 経由で到着しない限り認証する
認証され、アプリケーションは
DevConsoleHTTP 経由で Basic 認証を使用するか、Google アカウントと一致しないメールアドレスまたはパスワードを使用して接続しようとすると、HTTP 401 Unauthorized
レスポンス コードが返されます。
CardDAV を使用するには、まずクライアント プログラムを正規 URL に接続する必要があります
次に対して HTTP PROPFIND
を実行して、検出パスを指定します。
https://www.googleapis.com/.well-known/carddav
アドレス帳リソースにリダイレクト(HTTP 301
)されたら、クライアント プログラムは PROPFIND
を実行して DAV:current-user-principal
、DAV:principal-URL
、addressbook-home-set
プロパティを検出できます。クライアント プログラムは、addressbook-home-set
で PROPFIND
を実行し、addressbook
リソースと collection
リソースを検索することで、プリンシパル アドレス帳を検出できます。このプロセスの詳細については、このドキュメントでは説明しません。詳しくは、rfc6352 をご覧ください。
PROPFIND
を介して HTTP 301
レスポンスで返されるリダイレクト パス
(
rfc6764)。デバイスは既知の方法で再試行する必要があります
URI 検出を定期的に行い、キャッシュされたパスが最新の状態であり、
再同期する必要があります。2~4 週間ごとの実施をおすすめします。
リソース
CardDAV は REST のコンセプトを使用します。クライアント アプリケーションは、URI で指定されたリソースに対して動作します。現在の URI 構造は、
次のセクションで説明するコンセプトを理解していることを前提としています。構造は変更される可能性があるため、ハードコードしないでください。代わりに、RFC に従ってリソースを検出する必要があります。
- プリンシパル
<ph type="x-smartling-placeholder">
</ph>
- https://www.googleapis.com/carddav/v1/principals/
userEmail
- ホームセット
<ph type="x-smartling-placeholder">
</ph>
- https://www.googleapis.com/carddav/v1/principals/
userEmail
/lists
- アドレス帳
<ph type="x-smartling-placeholder">
</ph>
- https://www.googleapis.com/carddav/v1/principals/
userEmail
/lists/default
- お問い合わせ
- https://www.googleapis.com/carddav/v1/principals/
userEmail
/lists/default/contactId
サポートされているオペレーションの概要は次のとおりです。デベロッパーは、関連する RFC で詳細を確認する必要があります。リクエストとレスポンスはほとんど XML でエンコードされます。クライアント アプリケーションが同期に使用する主なオペレーションは次のとおりです。
- CTag を使用する
<ph type="x-smartling-placeholder">
</ph>
- クライアント プログラムは、アドレス帳リソースの
getctag
PROPFIND
リクエストを使用して、サーバーで連絡先が変更されたかどうか、つまり同期が必要かどうかを判断します。このプロパティの値は、連絡先が変更されると必ず変更されます。クライアント アプリケーション
この値を保存し、最初の同期でのみ使用し、
sync-token
が無効になった場合のフォールバックgetctag
プロパティを定期的にポーリングすると、スロットリングが発生します。
- sync-token の使用
<ph type="x-smartling-placeholder">
</ph>
- クライアント プログラムは、アドレス帳に対する
sync-token
PROPFIND
リクエストを使用して、現在の状態を表す sync-token
を取得します。クライアント
アプリケーションはこの値を保存し、定期的に sync-collection
を発行する必要があります。
REPORT
リクエストで、前回の発行からの変更を確認
sync-token
。発行されたトークンは 29 日間有効で、REPORT
レスポンスには新しい sync-token
が含まれます。
- ETag の使用
- クライアント アプリケーションが Address で
getetag
PROPFIND
リクエストを発行する
予約リソース(DEPTH
ヘッダーが DEPTH_1
と等しい)。インフラストラクチャを
各連絡先の ETag
値。クライアント プログラムは値をリクエストできます。
ETag
が変更された連絡先の割合。
- 連絡先の取得
- クライアント アプリケーションは、
addressbook-multiget
REPORT
リクエスト。連絡先 URI のリストが指定されている場合、レポートはリクエストされたすべての連絡先を VCard 3.0 値として返します。各エントリには、連絡先の ETag
が含まれています。
- 連絡先を挿入する
<ph type="x-smartling-placeholder">
</ph>
- クライアント アプリケーションは、VCard 3.0 形式の新しい連絡先を含む
POST
リクエストを発行します。レスポンスには、新しい連絡先の ID が含まれます。
- 連絡先の更新
- クライアント アプリケーションは、更新された連絡先を VCard 3.0 形式で含めて
PUT
リクエストを発行します。連絡先がアドレス帳にすでに存在する場合、連絡先が更新されます。
- クライアント アプリケーションには、連絡先の現在知られている
ETag
を含む If-Match
ヘッダーを含める必要があります。その後、サーバーは PUT
を拒否します。
サーバーの現在の ETag
が次の場合に HTTP 412
をリクエストし、
クライアント プログラムから送信された ETag
とは異なります。これにより、更新のオプティミスティック シリアル化が可能になります。
- 連絡先の削除
- クライアント アプリケーションが
DELETE
リクエストを発行して連絡先を削除する
照合されます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eGoogle Contacts can be accessed and managed using the CardDAV protocol, enabling client applications to create, edit, delete, and query contacts.\u003c/p\u003e\n"],["\u003cp\u003eGoogle's CardDAV implementation requires OAuth 2.0 for authentication and HTTPS for secure connections.\u003c/p\u003e\n"],["\u003cp\u003eClient applications should discover resource URIs dynamically instead of hardcoding them, as they are subject to change.\u003c/p\u003e\n"],["\u003cp\u003eContact synchronization can be achieved using CTag, sync-token, or ETags to efficiently track and update changes.\u003c/p\u003e\n"],["\u003cp\u003eGoogle's CardDAV utilizes VCard 3.0 for encoding contact data.\u003c/p\u003e\n"]]],["Google's CardDAV protocol allows managing contacts stored in a Google Account. Client applications can create, edit, delete, and query contacts using the CardDAV API. Key actions include using `PROPFIND` for discovery and obtaining `sync-token` and `getctag` for synchronization. Retrieving contacts is done with `addressbook-multiget REPORT`, while inserting, updating, and deleting contacts utilize `POST`, `PUT` (with `If-Match`), and `DELETE` requests, respectively. Authentication requires HTTPS and OAuth 2.0, and VCard 3.0 is the contact encoding format.\n"],null,["# Manage contacts with the CardDAV protocol\n\nYou can view and manage your contacts using Google's CardDAV protocol.\n\nContacts are stored in the user's Google Account; most Google services have\naccess to the contact list. Your client application can use the CardDAV API to\ncreate new contacts, edit or delete existing contacts, and query for contacts\nthat match particular criteria.\n\nSpecifications\n--------------\n\nThe full specification is not implemented, but many clients such as\n[Apple iOS™ Contacts](https://support.google.com/contacts/answer/2753077?co=GENIE.Platform%3DiOS)\nand macOS should interoperate correctly.\n\nFor each relevant specification, Google's CardDAV support is as follows:\n\n- [rfc2518: HTTP Extensions for Distributed Authoring (WebDAV)](https://tools.ietf.org/html/rfc2518)\n - Supports the HTTP methods `GET`, `PUT`, `DELETE`, `OPTIONS`, and `PROPFIND`.\n - Does *not* support the HTTP methods `LOCK`, `UNLOCK`, `COPY`, `MOVE`, or `MKCOL`.\n - Does *not* support arbitrary (user-defined) WebDAV properties.\n - Does *not* support WebDAV Access Control (rfc3744).\n- [rfc5995: Using POST to Add Members to WebDAV Collections](https://tools.ietf.org/html/rfc5995)\n - Supports creating new contacts without specifying an ID.\n- [rfc6352: CardDAV: vCard Extensions to Web Distributed Authoring and\n Versioning (WebDAV)](https://tools.ietf.org/html/rfc6352)\n - Supports the HTTP method `REPORT`, but not all defined reports are implemented.\n - Supports providing a principal collection and a contacts collection.\n- [rfc6578: Collection Synchronization for WebDAV](https://tools.ietf.org/html/rfc6578)\n - Client applications must switch to this mode of operation after the initial sync.\n- [rfc6749: The OAuth 2.0 Authorization Framework](https://tools.ietf.org/html/rfc6749) and [rfc6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage](https://tools.ietf.org/html/rfc6750)\n - Supports authenticating CardDAV client programs using OAuth 2.0 HTTP Authentication. Google does not support any other authentication method. For security of contact data, we require CardDAV connections to use [HTTPS](https://en.wikipedia.org/wiki/HTTPS).\n- [rfc6764: Locating Services for Calendaring Extensions to WebDAV (CalDAV) and vCard Extensions to WebDAV (CardDAV)](https://tools.ietf.org/html/rfc6764)\n - Bootstrapping of CardDAV URLs must take place according to section 6 of rfc6764.\n- Supports [caldav-ctag-02: Calendar Collection Entity Tag (CTag) in CalDAV](https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-ctag.txt), which is shared between the CardDAV and CalDAV specifications. The contacts `ctag` is like a resource `ETag`; it changes when anything in the contact address book has changed. This allows the client program to quickly determine that it does not need to synchronize any changed contacts.\n- Google uses VCard 3.0 as the contact encoding format. See: [rfc6350: VCard 3.0](https://tools.ietf.org/html/rfc6350).\n\nGoogle's CardDAV requires OAuth 2.0\n-----------------------------------\n\nGoogle's CardDAV interface requires OAuth 2.0. Refer to the linked\ndocumentation below for information on using OAuth 2.0 to access Google APIs:\n\n- [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/oauth2)\n- [Using OAuth 2.0 for Installed Applications](https://developers.google.com/identity/protocols/oauth2/native-app)\n\nConnecting to Google's CardDAV server\n-------------------------------------\n\nThe CardDAV protocol allows discovery of the address book and contact resources\nURIs. You must not hardcode any URI as they could change at any time.\n\nClient applications must use HTTPS, and `OAuth 2.0` authentication must be\nprovided for the user's Google account. The CardDAV server will not\nauthenticate a request unless it arrives over HTTPS with OAuth 2.0\nauthentication of a Google account, and your application is registered on\nDevConsole. Any attempt to connect over HTTP with Basic authentication or with\nan email/password that doesn't match a Google account results in an HTTP\n`401 Unauthorized` response code.\n\nTo use CardDAV, your client program must initially connect to the canonical\ndiscovery path by performing an HTTP `PROPFIND` on: \n\n https://www.googleapis.com/.well-known/carddav\n\nOnce redirected (`HTTP 301`) to an Address Book Resource, your client program\ncan then perform a `PROPFIND` on it to discover the\n`DAV:current-user-principal`, `DAV:principal-URL`, and `addressbook-home-set`\nproperties. Your client program can then discover the principal address book by\nperforming a `PROPFIND` on the `addressbook-home-set` and looking for the\n`addressbook` and `collection` resources. A full description of this process\nis beyond the scope of this document. See\n[rfc6352](https://tools.ietf.org/html/rfc6352) for more details.\n\nThe redirect path returned in the `HTTP 301` response through a `PROPFIND` on\nthe well-known URI must **not** be permanently cached (as per\n[rfc6764](https://tools.ietf.org/html/rfc6764)). Devices should retry well-known\nURI discovery periodically to verify if the cached path is still up to date and\nresync if the path ever changes. Google recommends a rate of every 2-4 weeks.\n\nResources\n---------\n\nCardDAV uses REST concepts. Client applications act on resources that are\ndesignated by their URIs. The current URI structure is specified here to help\ndevelopers understand the concepts in the following section. The structure may\nchange and must not be hardcoded. Rather, the resources should be discovered\naccording to the RFC.\n\n1. **Principal**\n - https://www.googleapis.com/carddav/v1/principals/\u003cvar class=\"apiparam\" translate=\"no\"\u003euserEmail\u003c/var\u003e\n2. **Home Set**\n - https://www.googleapis.com/carddav/v1/principals/\u003cvar class=\"apiparam\" translate=\"no\"\u003euserEmail\u003c/var\u003e/lists\n3. **Address Book**\n - https://www.googleapis.com/carddav/v1/principals/\u003cvar class=\"apiparam\" translate=\"no\"\u003euserEmail\u003c/var\u003e/lists/default\n4. **Contact**\n - https://www.googleapis.com/carddav/v1/principals/\u003cvar class=\"apiparam\" translate=\"no\"\u003euserEmail\u003c/var\u003e/lists/default/\u003cvar class=\"apiparam\" translate=\"no\"\u003econtactId\u003c/var\u003e\n\nSynchronizing Contacts\n----------------------\n\nThe following is a general description of the operations supported. Developers\nshould look for the details in the relevant RFC. Requests and responses are\nmostly encoded in XML. These are the main operations used by client\napplications for synchronization:\n\n- **Using CTag**\n - Client programs use the `getctag` `PROPFIND` request on the Address Book resource to determine if any contact has changed on the server and therefore whether a synchronization is needed. The value of this property is guaranteed to change if any contact changes. Client applications should store this value and use it only on the initial sync and as a fallback when a `sync-token` is invalidated. Periodically polling for the `getctag` property will result in throttling.\n- **Using sync-token**\n - Client programs use the `sync-token` `PROPFIND` request on the Address Book to obtain the `sync-token` representing its current state. Client applications must store this value and issue periodic `sync-collection` `REPORT` requests to determine changes since the last issued `sync-token`. Issued tokens are valid for 29 days, and the `REPORT` response will contain a new `sync-token`.\n- **Using ETags**\n - Client applications issue a `getetag` `PROPFIND` request on the Address Book resource (with `DEPTH` header equal to `DEPTH_1`). By maintaining the `ETag` value of each contact, a client program can request the value of contacts that had their `ETag` changed.\n- **Retrieving contacts**\n - Client applications retrieve contacts by issuing an `addressbook-multiget` `REPORT` request. Given a list of contact URIs, the report returns all the requested contacts as VCard 3.0 values. Each entry includes an `ETag` for the contact.\n- **Inserting a contact**\n - Client applications issue a `POST` request with the new contact in VCard 3.0 format. The response will contain the ID of the new contact.\n- **Updating a contact**\n - Client applications issue a `PUT` request with the updated contact in VCard 3.0 format. The contact is updated if the contact already exists in the address book.\n - Client applications should include an `If-Match` header with the contact's currently known `ETag`. The server will then reject the `PUT` request (with `HTTP 412`) if the current `ETag` on the server is different from the `ETag` sent by the client program. This allows for optimistic serialization of updates.\n- **Deleting a contact**\n - Client applications delete a contact by issuing a `DELETE` request against the contact URI."]]