Method: people.get
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ให้ข้อมูลเกี่ยวกับบุคคลโดยระบุชื่อทรัพยากร ใช้ people/me
เพื่อระบุผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว
คำขอแสดงข้อผิดพลาด 400 หากไม่ได้ระบุ "personFields"
คำขอ HTTP
GET https://people.googleapis.com/v1/{resourceName=people/*}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
resourceName |
string
ต้องระบุ ชื่อทรัพยากรของบุคคลที่จะให้ข้อมูล
- หากต้องการดูข้อมูลเกี่ยวกับผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว ให้ระบุ
people/me
- หากต้องการดูข้อมูลเกี่ยวกับบัญชี Google ให้ระบุ
people/{account_id}
- หากต้องการดูข้อมูลเกี่ยวกับรายชื่อติดต่อ ให้ระบุชื่อทรัพยากรที่ระบุว่ารายชื่อติดต่อนั้นส่งคืนโดย
people.connections.list
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
requestMask (deprecated) |
object (RequestMask )
เลิกใช้งานแล้ว (โปรดใช้ personFields แทน) มาสก์เพื่อจำกัดผลลัพธ์ในช่องบุคคลบางส่วน
|
personFields |
string (FieldMask format)
ต้องระบุ ฟิลด์มาสก์เพื่อจำกัดฟิลด์ที่ผู้ใช้ส่งคืน คุณระบุได้หลายช่องโดยคั่นด้วยเครื่องหมายคอมมา ค่าที่ใช้ได้มีดังนี้
- ที่อยู่
- ageRanges
- ชีวประวัติ
- วันเกิด
- calendarUrls
- clientData
- coverPhotos
- emailAddresses
- กิจกรรม
- externalIds
- เพศ
- imClients
- ความสนใจ
- locales
- สถานที่ตั้ง
- ของช่อง
- ข้อมูลเมตา
- miscKeywords
- names
- ชื่อเล่น
- อาชีพ
- organizations
- phoneNumbers
- ภาพถ่าย
- ความสัมพันธ์
- sipAddresses
- ทักษะ
- urls
- userDefined
|
sources[] |
enum (ReadSourceType )
ไม่บังคับ มาสก์ของประเภทแหล่งที่มาที่จะแสดงผล ค่าเริ่มต้นจะเป็น READ_SOURCE_TYPE_PROFILE และ READ_SOURCE_TYPE_CONTACT หากไม่ได้ตั้งค่าไว้
|
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Person
ขอบเขตการให้สิทธิ์
ไม่จำเป็นต้องมีการให้สิทธิ์ในการเข้าถึงข้อมูลสาธารณะ สำหรับข้อมูลส่วนตัว ต้องมีขอบเขต OAuth รายการใดรายการหนึ่งต่อไปนี้
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
โปรดดูข้อมูลเพิ่มเติมที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-08-06 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2024-08-06 UTC"],[[["\u003cp\u003eRetrieves information about a person, including the authenticated user using \u003ccode\u003epeople/me\u003c/code\u003e or by specifying a resource name.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003epersonFields\u003c/code\u003e query parameter to specify which fields to include in the response, otherwise, it returns a 400 error.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering the source of the data using the \u003ccode\u003esources[]\u003c/code\u003e parameter and supports various authorization scopes for accessing private data.\u003c/p\u003e\n"],["\u003cp\u003eUses a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003ehttps://people.googleapis.com/v1/{resourceName=people/*}\u003c/code\u003e endpoint with optional query parameters.\u003c/p\u003e\n"],["\u003cp\u003eResponse includes a \u003ca href=\"/people/api/rest/v1/people#Person\"\u003ePerson\u003c/a\u003e object containing the requested information if successful.\u003c/p\u003e\n"]]],["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"],null,["# Method: people.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nProvides information about a person by specifying a resource name. 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/{resourceName=people/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `resourceName` | `string` Required. The resource name of the person to provide information about. - 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). |\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\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 the 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_PROFILE](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_PROFILE) and [READ_SOURCE_TYPE_CONTACT](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_CONTACT) if not set. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [Person](/people/api/rest/v1/people#Person).\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)."]]