Method: people.searchContacts
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-08-06 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-08-06 UTC."],[[["\u003cp\u003eSearches the authenticated user's contacts for matches against names, nicknames, email addresses, phone numbers, and organizations from the CONTACT source.\u003c/p\u003e\n"],["\u003cp\u003eSupports prefix phrase matching for the query against contact fields.\u003c/p\u003e\n"],["\u003cp\u003eRequires a warmup request with an empty query prior to the actual search to ensure cache freshness.\u003c/p\u003e\n"],["\u003cp\u003eAllows specifying the number of results to return (up to 30) and the fields to include in the response.\u003c/p\u003e\n"],["\u003cp\u003eNeeds authorization with either \u003ccode\u003ehttps://www.googleapis.com/auth/contacts\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/contacts.readonly\u003c/code\u003e scope.\u003c/p\u003e\n"]]],["This content describes how to search for contacts via the `searchContacts` API. Key actions include sending a `GET` request to `https://people.googleapis.com/v1/people:searchContacts` with a plain-text `query`, `pageSize`, `readMask`, and optional `sources`. A warmup request with an empty `query` is suggested to update the cache. The `query` searches various contact fields. The response returns matching contacts specified by `readMask` and is found in the `SearchResponse` object. Authorization is needed through specific OAuth scopes.\n"],null,["# Method: people.searchContacts\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nProvides a list of contacts in the authenticated user's grouped contacts that matches the search query. The query matches on a contact's `names`, `nickNames`, `emailAddresses`, `phoneNumbers`, and `organizations` fields that are from the [CONTACT](/people/api/rest/v1/people#Person.SourceType) source.\n\n**IMPORTANT** : Before searching, clients should send a warmup request with an empty query to update the cache. See \u003chttps://developers.google.com/people/v1/contacts#search_the_users_contacts\u003e\n\n### HTTP request\n\n`GET https://people.googleapis.com/v1/people:searchContacts`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `query` | `string` Required. The plain-text query for the request. The query is used to match prefix phrases of the fields on a person. For example, a person with name \"foo name\" matches queries such as \"f\", \"fo\", \"foo\", \"foo n\", \"nam\", etc., but not \"oo n\". |\n| `pageSize` | `integer` Optional. The number of results to return. Defaults to 10 if field is not set, or set to 0. Values greater than 30 will be capped to 30. |\n| `readMask` | `string (`[FieldMask](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask)` format)` Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: - addresses - ageRanges - biographies - birthdays - calendarUrls - clientData - coverPhotos - emailAddresses - events - externalIds - genders - imClients - interests - locales - locations - memberships - metadata - miscKeywords - names - nicknames - occupations - organizations - phoneNumbers - photos - relations - sipAddresses - skills - urls - userDefined |\n| `sources[]` | `enum (`[ReadSourceType](/people/api/rest/v1/ReadSourceType)`)` Optional. A mask of what source types to return. Defaults to [READ_SOURCE_TYPE_CONTACT](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_CONTACT) if not set. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [SearchResponse](/people/api/rest/v1/SearchResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/contacts`\n- `https://www.googleapis.com/auth/contacts.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]