Method: people.get
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
با تعیین نام منبع، اطلاعاتی در مورد یک شخص ارائه می دهد. people/me
برای نشان دادن کاربر تایید شده استفاده کنید.
اگر «personFields» مشخص نشده باشد، درخواست یک خطای 400 برمیگرداند.
درخواست HTTP
GET https://people.googleapis.com/v1/{resourceName=people/*}
URL از دستور GRPC Transcoding استفاده می کند.
پارامترهای مسیر
مولفه های |
---|
resourceName | string ضروری. نام منبع شخص برای ارائه اطلاعات در مورد. - برای دریافت اطلاعات در مورد کاربر احراز هویت شده،
people/me را مشخص کنید. - برای دریافت اطلاعات درباره حساب Google،
people/{account_id} را مشخص کنید. - برای دریافت اطلاعات در مورد یک مخاطب، نام منبعی را مشخص کنید که مخاطب را به عنوان بازگردانده شده توسط
people.connections.list مشخص می کند.
|
پارامترهای پرس و جو
مولفه های |
---|
requestMask (deprecated) | object ( RequestMask ) منسوخ شده (لطفا به جای آن از personFields استفاده کنید) ماسکی برای محدود کردن نتایج به زیر مجموعه ای از فیلدهای شخص. |
personFields | string ( FieldMask format) ضروری. یک فیلد ماسک برای محدود کردن اینکه کدام فیلدها بر روی شخص بازگردانده می شوند. چندین فیلد را می توان با جدا کردن آنها با کاما مشخص کرد. مقادیر معتبر عبارتند از: - آدرس ها
- محدوده های سنی
- بیوگرافی ها
- تولدها
- calendarUrls
- کلاینت دیتا
- عکسهای روی جلد
- آدرس ایمیل
- مناسبت ها
- شناسه های خارجی
- جنسیت ها
- imClients
- منافع
- مناطق
- مکان ها
- عضویت ها
- فراداده
- کلمات کلیدی اشتباه
- نام ها
- نام مستعار
- مشاغل
- سازمان های
- شماره تلفن ها
- عکس ها
- روابط
- آدرس های sip
- مهارت ها
- آدرس های اینترنتی
- تعریف شده توسط کاربر
|
sources[] | enum ( ReadSourceType ) اختیاری. ماسکی از نوع منبع برای بازگشت. در صورت تنظیم نشدن، پیشفرض READ_SOURCE_TYPE_PROFILE و READ_SOURCE_TYPE_CONTACT است. |
درخواست بدن
بدنه درخواست باید خالی باشد.
بدن پاسخگو
در صورت موفقیت آمیز بودن، بدنه پاسخ حاوی نمونه ای از Person
است.
محدوده مجوز
برای دسترسی به داده های عمومی نیازی به مجوز نیست. برای داده های خصوصی، یکی از حوزه های OAuth زیر مورد نیاز است:
-
https://www.googleapis.com/auth/contacts
-
https://www.googleapis.com/auth/contacts.readonly
-
https://www.googleapis.com/auth/contacts.other.readonly
-
https://www.googleapis.com/auth/directory.readonly
-
https://www.googleapis.com/auth/profile.agerange.read
-
https://www.googleapis.com/auth/profile.emails.read
-
https://www.googleapis.com/auth/profile.language.read
-
https://www.googleapis.com/auth/user.addresses.read
-
https://www.googleapis.com/auth/user.birthday.read
-
https://www.googleapis.com/auth/user.emails.read
-
https://www.googleapis.com/auth/user.gender.read
-
https://www.googleapis.com/auth/user.organization.read
-
https://www.googleapis.com/auth/user.phonenumbers.read
-
https://www.googleapis.com/auth/userinfo.email
-
https://www.googleapis.com/auth/userinfo.profile
-
https://www.googleapis.com/auth/profile.language.read
برای اطلاعات بیشتر، به راهنمای مجوز مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-08-06 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2024-08-06 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eRetrieves information about a person, including the authenticated user using \u003ccode\u003epeople/me\u003c/code\u003e or by specifying a resource name.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003epersonFields\u003c/code\u003e query parameter to specify which fields to include in the response, otherwise, it returns a 400 error.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering the source of the data using the \u003ccode\u003esources[]\u003c/code\u003e parameter and supports various authorization scopes for accessing private data.\u003c/p\u003e\n"],["\u003cp\u003eUses a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003ehttps://people.googleapis.com/v1/{resourceName=people/*}\u003c/code\u003e endpoint with optional query parameters.\u003c/p\u003e\n"],["\u003cp\u003eResponse includes a \u003ca href=\"/people/api/rest/v1/people#Person\"\u003ePerson\u003c/a\u003e object containing the requested information if successful.\u003c/p\u003e\n"]]],["This outlines how to retrieve person information via a `GET` request to `https://people.googleapis.com/v1/{resourceName=people/*}`. The `resourceName` path parameter specifies the person (e.g., `people/me` for the authenticated user). The `personFields` query parameter is mandatory and dictates the data returned. The request body must be empty. A successful request returns a `Person` resource. Authorization is needed for private data. A `400` error is returned if `personFields` is not specified.\n"],null,["# Method: people.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\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 information about a person by specifying a resource name. Use `people/me` to indicate the authenticated user.\n\nThe request returns a 400 error if 'personFields' is not specified.\n\n### HTTP request\n\n`GET https://people.googleapis.com/v1/{resourceName=people/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `resourceName` | `string` Required. The resource name of the person to provide information about. - To get information about the authenticated user, specify `people/me`. - To get information about a google account, specify `people/{account_id}`. - To get information about a contact, specify the resource name that identifies the contact as returned by [`people.connections.list`](/people/api/rest/v1/people.connections/list#google.people.v1.PeopleService.ListConnections). |\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestMask` **(deprecated)** | `object (`[RequestMask](/people/api/rest/v1/RequestMask)`)` **DEPRECATED** (Please use `personFields` instead) A mask to restrict results to a subset of person fields. |\n| `personFields` | `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 the 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_PROFILE](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_PROFILE) and [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 [Person](/people/api/rest/v1/people#Person).\n\n### Authorization scopes\n\nNo authorization required to access public data. For private data, one of the following OAuth scopes is required:\n\n- `https://www.googleapis.com/auth/contacts`\n- `https://www.googleapis.com/auth/contacts.readonly`\n- `https://www.googleapis.com/auth/contacts.other.readonly`\n- `https://www.googleapis.com/auth/directory.readonly`\n- `https://www.googleapis.com/auth/profile.agerange.read`\n- `https://www.googleapis.com/auth/profile.emails.read`\n- `https://www.googleapis.com/auth/profile.language.read`\n- `https://www.googleapis.com/auth/user.addresses.read`\n- `https://www.googleapis.com/auth/user.birthday.read`\n- `https://www.googleapis.com/auth/user.emails.read`\n- `https://www.googleapis.com/auth/user.gender.read`\n- `https://www.googleapis.com/auth/user.organization.read`\n- `https://www.googleapis.com/auth/user.phonenumbers.read`\n- `https://www.googleapis.com/auth/userinfo.email`\n- `https://www.googleapis.com/auth/userinfo.profile`\n- `https://www.googleapis.com/auth/profile.language.read`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]