Google Health API를 사용하면 사용자가 제출한 건강 및 웰빙 데이터에 액세스할 수 있습니다. 사용자 프로필 정보는
getProfile 엔드포인트를 통해 제공되지만 연령 및 멤버십 시작일과 같은 측정항목으로
제한됩니다.
추가 사용자 프로필 정보를 가져오려면
People API를 사용하면 됩니다. 추가 범위에 대한 승인을 요청해야 할 수도 있습니다. 예를 들어 사용자의 생일을 읽으려면 승인 요청에 https://www.googleapis.com/auth/user.birthday.read 및 https://www.googleapis.com/auth/userinfo.profile을 포함해야 합니다. People API 승인에 관한 자세한 내용은 요청 승인을 참고하세요.
예를 들어 People API를 사용하여 사용자의 생일을 가져오려면 다음 단계를 따르세요.
프로토콜
GET /v1/people/me?personFields=birthdays HTTP/1.1 Host: people.googleapis.com
자바
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'));
.NET
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 } } ] }