پروفایل ها را بخوانید
با مجموعهها، منظم بمانید
ذخیره و دستهبندی محتوا براساس اولویتهای شما.
پس از تکمیل مراحل Get Ready to Use People API ، آماده خواندن داده های نمایه ها هستید.
نمونه کد زیر نحوه ارسال چند درخواست ساده را نشان می دهد. برای فهرست کامل روشها، به مستندات مرجع مراجعه کنید.
شخص مورد نظر را برای کاربر تأیید شده دریافت کنید
برای دریافت مشخصات کاربر از کد زیر استفاده کنید:
پروتکل
GET /v1/people/me?personFields=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
جاوا
Person profile = peopleService.people().get("people/me")
.setPersonFields("names,emailAddresses")
.execute();
پایتون
profile = people_service.people()
.get('people/me', personFields='names,emailAddresses')
PHP
$profile = $people_service->people->get(
'people/me', array('personFields' => 'names,emailAddresses'));
دات نت
PeopleResource.GetRequest peopleRequest =
peopleService.People.Get("people/me");
peopleRequest.PersonFields = "names,emailAddresses";
Person profile = peopleRequest.Execute();
شخص را برای شناسه حساب Google دریافت کنید
برای دریافت اطلاعات شخص برای شناسه حساب Google ، از کد زیر استفاده کنید:
پروتکل
GET /v1/people/account_id?personFields=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
جاوا
Person profile = peopleService.people().get("people/account_id")
.setPersonFields("names,emailAddresses")
.execute();
پایتون
profile = people_service.people()
.get('people/account_id', personFields='names,emailAddresses')
PHP
$profile = $people_service->people->get(
'people/account_id', array('personFields' => 'names,emailAddresses'));
دات نت
PeopleResource.GetRequest peopleRequest =
peopleService.People.Get("people/account_id");
peopleRequest.PersonFields = "names,emailAddresses";
Person profile = peopleRequest.Execute();
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-11-23 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-11-23 بهوقت ساعت هماهنگ جهانی."],[[["This page provides code samples demonstrating how to read profile data using the People API after completing the initial setup."],["You can retrieve the authenticated user's profile, including names and email addresses, using the provided code snippets."],["The guide also includes code examples for fetching profile information for a specific Google Account ID, specifying the desired person fields."]]],["The provided code samples demonstrate how to retrieve profile data using the People API. Users can get the authenticated user's profile by sending a `GET` request to `/v1/people/me` or retrieve a profile by Google Account ID using `/v1/people/\u003caccount_id\u003e`. Both requests use the `personFields` parameter, specifying `names,emailAddresses` to filter for those specific fields. Different languages are exemplified such as Java, Python, PHP and .NET, showing how to form the API request.\n"]]