Информация профиля пользователя

API Google Health предоставляет доступ к данным о здоровье и самочувствии, предоставленным пользователями. Информация профиля пользователя доступна через конечную точку getProfile , но ограничена такими показателями, как возраст и дата начала членства.

To get additional user profile information, you can use the People API . You may need to request authorization for additional scopes. For example, to read the user's birthday, you must include https://www.googleapis.com/auth/user.birthday.read and https://www.googleapis.com/auth/userinfo.profile in your authorization request. For more information on People API authorization, see Authorize Requests .

For example, to get the user's birthday using People API :

Протокол

GET /v1/people/me?personFields=birthdays HTTP/1.1
Host: people.googleapis.com

Java

Person profile = peopleService.people().get("people/me")
    .setPersonFields("birthdays")
    .execute();

Python

profile = people_service.people()
    .get('people/me', personFields='birthdays')

PHP

$profile = $people_service->people->get(
    'people/me', array('personFields' => 'birthdays'));

.СЕТЬ

PeopleResource.GetRequest peopleRequest =
    peopleService.People.Get("people/me");
peopleRequest.PersonFields = "birthdays";
Person profile = peopleRequest.Execute();

Ответ

{
  "resourceName": "people/115549...",
  "etag": "%EgQBBy43...",
  "birthdays": [
    {
      "metadata": {
        "primary": true,
        "source": {
          "type": "DOMAIN_PROFILE",
          "id": "115549..."
        }
      },
      "date": {
        "month": 1,
        "day": 1
      }
    },
    {
      "metadata": {
        "source": {
          "type": "ACCOUNT",
          "id": "115549..."
        }
      },
      "date": {
        "year": 1990,
        "month": 1,
        "day": 1
      }
    }
  ]
}