Method: people.get
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Cung cấp thông tin về một người bằng cách chỉ định tên tài nguyên. Sử dụng people/me
để cho biết người dùng đã xác thực.
Yêu cầu này trả về lỗi 400 nếu không chỉ định "personFields".
Yêu cầu HTTP
GET https://people.googleapis.com/v1/{resourceName=people/*}
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Tham số |
resourceName |
string
Bắt buộc. Tên tài nguyên của người cần cung cấp thông tin.
- Để nhận thông tin về người dùng đã xác thực, hãy chỉ định
people/me .
- Để nhận thông tin về một Tài khoản Google, hãy chỉ định
people/{account_id} .
- Để lấy thông tin về một mục liên hệ, hãy chỉ định tên tài nguyên giúp xác định mục liên hệ đó do
people.connections.list trả về.
|
Tham số truy vấn
Tham số |
requestMask (deprecated) |
object (RequestMask )
KHÔNG DÙNG NỮA (Vui lòng sử dụng personFields để thay thế) Một mặt nạ để giới hạn kết quả trong một nhóm nhỏ các trường chứa người dùng.
|
personFields |
string (FieldMask format)
Bắt buộc. Mặt nạ trường (field mask) để hạn chế những trường trên người được trả về. Bạn có thể chỉ định nhiều trường bằng cách dùng dấu phẩy phân tách các trường. Các giá trị hợp lệ là:
- các địa chỉ
- ageRanges
- tiểu sử
- sinh nhật
- calendarUrls
- clientData
- coverPhotos
- emailAddresses
- sự kiện
- externalIds
- giới tính
- imClients
- sở thích
- locales
- vị trí
- của kênh
- siêu dữ liệu
- miscKeywords
- names
- biệt hiệu
- nghề nghiệp
- organizations
- phoneNumbers
- ảnh
- quan hệ
- sipAddresses
- kỹ năng
- urls
- userDefined
|
sources[] |
enum (ReadSourceType )
Không bắt buộc. Mặt nạ cho biết các loại nguồn cần trả về. Giá trị mặc định là READ_SOURCE_TYPE_PROFILE và READ_SOURCE_TYPE_CONTACT nếu không được đặt.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một phiên bản của Person
.
Phạm vi uỷ quyền
Bạn không cần phải cho phép truy cập vào dữ liệu công khai. Đối với dữ liệu riêng tư, cần phải sử dụng một trong các phạm vi OAuth sau đây:
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
Để biết thêm thông tin, hãy xem bài viết Hướng dẫn uỷ quyền.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-08-06 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2024-08-06 UTC."],[[["Retrieves information about a person, including the authenticated user using `people/me` or by specifying a resource name."],["Requires the `personFields` query parameter to specify which fields to include in the response, otherwise, it returns a 400 error."],["Allows filtering the source of the data using the `sources[]` parameter and supports various authorization scopes for accessing private data."],["Uses a `GET` request to the `https://people.googleapis.com/v1/{resourceName=people/*}` endpoint with optional query parameters."],["Response includes a [Person](/people/api/rest/v1/people#Person) object containing the requested information if successful."]]],["This outlines how to retrieve person information via a `GET` request to `https://people.googleapis.com/v1/{resourceName=people/*}`. The `resourceName` path parameter specifies the person (e.g., `people/me` for the authenticated user). The `personFields` query parameter is mandatory and dictates the data returned. The request body must be empty. A successful request returns a `Person` resource. Authorization is needed for private data. A `400` error is returned if `personFields` is not specified.\n"]]