Method: people.getBatchGet
Stay organized with collections
Save and categorize content based on your preferences.
Provides information about a list of specific people by specifying a list of requested resource names. Use people/me
to indicate the authenticated user.
The request returns a 400 error if 'personFields' is not specified.
HTTP request
GET https://people.googleapis.com/v1/people:batchGet
The URL uses gRPC Transcoding
syntax.
Query parameters
resourceNames[]
string
Required. The resource names of the people to provide information about. It's repeatable. The URL query parameter should be
resourceNames=<name1>&resourceNames=<name2>&...
- 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
.
There is a maximum of 200 resource names.
requestMask
(deprecated)
object ( RequestMask
)
DEPRECATED(Please use personFields
instead)
A mask to restrict results to a subset of person fields.
personFields
string ( FieldMask
format)
Required. A field mask to restrict which fields on each 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
Request body
The request body must be empty.
Response body
The response to a get request for a list of people by resource name.
If successful, the response body contains data with the following structure:
Fields |
responses[]
|
object ( PersonResponse
)
The response for each requested resource name.
|
Authorization scopes
No authorization required to access public data. For private data, one of the following OAuth scopes is required:
-
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
For more information, see the Authorization guide
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eRetrieves information about a list of specific people, including the authenticated user, by specifying resource names.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003epersonFields\u003c/code\u003e query parameter to specify desired data fields and returns a 400 error if it's missing.\u003c/p\u003e\n"],["\u003cp\u003eSupports various authorization scopes for accessing private data, although public data requires no authorization.\u003c/p\u003e\n"],["\u003cp\u003eReturns a JSON response containing an array of \u003ccode\u003ePersonResponse\u003c/code\u003e objects, each corresponding to a requested resource name.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003eGET\u003c/code\u003e HTTP method and the \u003ccode\u003ehttps://people.googleapis.com/v1/people:batchGet\u003c/code\u003e endpoint with gRPC Transcoding syntax.\u003c/p\u003e\n"]]],["This outlines how to retrieve information about specific people using the `people:batchGet` endpoint via a `GET` HTTP request. You must provide `resourceNames` (up to 200) in the query, identifying each person (e.g., `people/me` or `people/{account_id}`). The `personFields` parameter is required to specify which person attributes to include. The request body is empty. The response returns an array of `PersonResponse` objects, one for each requested resource name, and requires authorization scopes for private data. A 400 error is returned if 'personFields' are not provided.\n"],null,["# Method: people.getBatchGet\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.GetPeopleResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nProvides information about a list of specific people by specifying a list of requested resource names. 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/people:batchGet`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `resourceNames[]` | `string` Required. The resource names of the people to provide information about. It's repeatable. The URL query parameter should be `resourceNames=\u003cname1\u003e&resourceNames=\u003cname2\u003e&...` - 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). There is a maximum of 200 resource names. |\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 each 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_CONTACT](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_CONTACT) and [READ_SOURCE_TYPE_PROFILE](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_PROFILE) if not set. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nThe response to a get request for a list of people by resource name.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------|\n| ``` { \"responses\": [ { object (/people/api/rest/v1/PersonResponse) } ] } ``` |\n\n| Fields ||\n|---------------|------------------------------------------------------------------------------------------------------------------|\n| `responses[]` | `object (`[PersonResponse](/people/api/rest/v1/PersonResponse)`)` The response for each requested resource name. |\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)."]]