Profil Okuma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
People API'yi Kullanmaya Hazırlanma bölümündeki adımları tamamladıktan sonra profillerle ilgili verileri okumaya hazırsınız demektir.
Aşağıdaki kod örnekleri, birkaç basit isteğin nasıl gönderileceğini göstermektedir. Yöntemlerin tam listesi için referans dokümanlarını inceleyin.
Kimliği doğrulanmış kullanıcının kimliğini alma
Kullanıcı profilini almak için aşağıdaki kodu kullanın:
Protokol
GET /v1/people/me?personFields=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
Java
Person profile = peopleService.people().get("people/me")
.setPersonFields("names,emailAddresses")
.execute();
Python
profile = people_service.people()
.get('people/me', personFields='names,emailAddresses')
PHP
$profile = $people_service->people->get(
'people/me', array('personFields' => 'names,emailAddresses'));
.NET
PeopleResource.GetRequest peopleRequest =
peopleService.People.Get("people/me");
peopleRequest.PersonFields = "names,emailAddresses";
Person profile = peopleRequest.Execute();
Google Hesabı kimliği için kullanıcıyı alma
Bir Google Hesabı kimliğiyle ilgili kullanıcı bilgilerini almak için aşağıdaki kodu kullanın:
Protokol
GET /v1/people/account_id?personFields=names,emailAddresses HTTP/1.1
Host: people.googleapis.com
Java
Person profile = peopleService.people().get("people/account_id")
.setPersonFields("names,emailAddresses")
.execute();
Python
profile = people_service.people()
.get('people/account_id', personFields='names,emailAddresses')
PHP
$profile = $people_service->people->get(
'people/account_id', array('personFields' => 'names,emailAddresses'));
.NET
PeopleResource.GetRequest peopleRequest =
peopleService.People.Get("people/account_id");
peopleRequest.PersonFields = "names,emailAddresses";
Person profile = peopleRequest.Execute();
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-11-23 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-11-23 UTC."],[[["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"]]