บทนำ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
People API ช่วยให้คุณทำสิ่งต่อไปนี้ได้
- อ่านและจัดการรายชื่อติดต่อของผู้ใช้ที่ผ่านการตรวจสอบสิทธิ์
- อ่านและคัดลอก "รายชื่อติดต่ออื่นๆ" ของผู้ใช้ที่ผ่านการตรวจสอบสิทธิ์
- อ่านข้อมูลโปรไฟล์ของผู้ใช้ที่ตรวจสอบสิทธิ์แล้วและรายชื่อติดต่อ
- อ่านโปรไฟล์และข้อมูลติดต่อของโดเมน
ตัวอย่างเช่น สมมติว่า Jen ซึ่งเป็นผู้ใช้ที่ตรวจสอบสิทธิ์แล้ว มี Fabian และ Ranjith อยู่ใน
รายชื่อติดต่อส่วนตัว เมื่อแอปของคุณเรียก people.connections.list
ให้อ่านรายการการเชื่อมต่อ เจนจะเห็นหน้าจอขอความยินยอมที่ขอสิทธิ์เข้าถึงรายการดังกล่าว หากเจนยินยอม แอปจะอ่านรายการที่มี person resources
ของฟาเบียนและรัญจิธ
หากแอปต้องการข้อมูลสำหรับบุคคลที่ระบุ แอปจะเรียกใช้ people.get
โดยการส่งชื่อทรัพยากรเพื่อรับ person resource
สำหรับบุคคลนั้น
แอปนี้ยังสามารถจัดการรายชื่อติดต่อได้โดยการสร้างรายชื่อติดต่อใหม่โดยใช้ people.createContact
อัปเดตรายชื่อติดต่อที่มีอยู่ที่แอปอ่านแล้วจาก
people.connections.list
โดยใช้
people.updateContact
และลบรายชื่อติดต่อโดยใช้ people.deleteContact
ผู้ใช้ Google Workspace ยังแสดงรายการโปรไฟล์โดเมนไดเรกทอรีและข้อมูลติดต่อของโดเมนโดยใช้ people.listDirectoryPeople
หรือค้นหาโดยใช้ people.searchDirectoryPeople
ได้อีกด้วย
ข้อมูลบุคคลที่ People API อ่านจะรวมมาจากแหล่งที่มาต่างๆ โดยขึ้นอยู่กับเงื่อนไขต่อไปนี้
ทำความเข้าใจข้อมูลบุคคลที่ผสาน
ข้อมูลของบุคคลหนึ่งๆ จะมาจากแหล่งข้อมูลหลักประเภทหนึ่ง ข้อมูลจากแหล่งที่มาอื่นๆ จะรวมเข้ากับข้อมูลนี้หากแหล่งที่มาเชื่อมโยงกันผ่านที่อยู่อีเมล หมายเลขโทรศัพท์ หรือ URL ของโปรไฟล์ที่ได้รับการยืนยัน นี่คือวิธีที่บุคคลสามารถเขียนได้
ปลายทางการเปลี่ยนแปลงจะแก้ไขได้เฉพาะผู้ใช้ตามรายชื่อติดต่อ ระบบไม่รองรับการเปลี่ยนแปลงรายชื่อติดต่อในโปรไฟล์และโดเมน
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 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"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThe People API allows reading and managing the authenticated user's contacts, including private contacts and "Other contacts".\u003c/p\u003e\n"],["\u003cp\u003eUsers can access profile information for authenticated users and their contacts, including public Google profile data and, when permitted, Google Workspace domain profile data.\u003c/p\u003e\n"],["\u003cp\u003eThe API facilitates managing contacts by creating, updating, and deleting contacts through specific endpoints.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Workspace users can utilize the API to list and search domain profiles and domain contacts.\u003c/p\u003e\n"],["\u003cp\u003eThe People API merges data from various sources like public profiles, private profiles, contacts, and domain information based on verified email addresses, phone numbers, or profile URLs.\u003c/p\u003e\n"]]],["The People API enables reading and managing authenticated user contacts, \"Other contacts,\" and profile information, including domain profiles. Apps can list connections via `people.connections.list`, retrieve specific person data using `people.get`, create contacts with `people.createContact`, update contacts with `people.updateContact`, and delete contacts via `people.deleteContact`. Google Workspace users can access domain contacts using `people.listDirectoryPeople` or `people.searchDirectoryPeople`. The data is merged from sources like public profiles, domain data, and private information, depending on user consent and scopes granted.\n"],null,["The People API lets you:\n\n- Read and manage the authenticated user's [Contacts](https://contacts.google.com)\n- Read and copy the authenticated user's [\"Other contacts\"](https://contacts.google.com/other)\n- Read profile information for authenticated users and their contacts\n- Read domain profiles and contacts\n\nFor example, suppose that the authenticated user, Jen, has Fabian and Ranjith in\nher private contacts. When your app calls\n[`people.connections.list`](/people/api/rest/v1/people.connections/list) to read a\nlist of her connections, Jen is presented with a consent screen asking to give\nthe app access to the list. If Jen consents, the app reads a list containing\n[`person resources`](/people/api/rest/v1/people) for Fabian and Ranjith.\n\nIf the app needs information for a specific person, it can then call\n[`people.get`](/people/api/rest/v1/people/get), passing in a resource name, to get\nthe [`person resource`](/people/api/rest/v1/people) for that person.\n\nThe app can also manage contacts by creating new contacts using\n[`people.createContact`](/people/api/rest/v1/people/createContact), update existing\ncontacts it has read from\n[`people.connections.list`](/people/api/rest/v1/people.connections/list) using\n[`people.updateContact`](/people/api/rest/v1/people/updateContact), and delete contacts\nusing [`people.deleteContact`](/people/api/rest/v1/people/deleteContact).\n\nGoogle Workspace users can also list their directory domain profiles and domain\ncontacts using\n[`people.listDirectoryPeople`](/people/api/rest/v1/people/listDirectoryPeople) or search\nthem using\n[`people.searchDirectoryPeople`](/people/api/rest/v1/people/searchDirectoryPeople).\n\nA merged view of people information\n\nThe people information that the People API reads is merged from various\nsources, depending on the following conditions:\n\n| Source | Condition |\n|------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Public Google profile data | Always. |\n| Google Workspace domain profile data | The domain admin has [enabled external contact and profile sharing](https://support.google.com/a/answer/6343701) of domain-scoped data and the [`directory.readonly` scope](/people/v1/how-tos/authorizing#directory) has been granted |\n| The authenticated user's private profile information | One of the [`profile` scopes](/people/v1/how-tos/authorizing#OAuth2Authorizing) has been granted. |\n| The authenticated user's contacts | The [`contacts` scope](/people/v1/how-tos/authorizing#contacts) has been granted. |\n\nUnderstanding Merged Person Data\n\nThe data for a person is derived from one main source type. Data from other\nsources is merged with this data if the sources are connected through verified\nemail addresses, phone numbers, or profile URLs. These are the ways a person may\nbe composed:\n\n| Main Source | Contacts | Profiles | Google Workspace Domain Profiles | Google Workspace Domain Contacts | Usage |\n|----------------|----------|----------|----------------------------------|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Contact | 1 | 0+ | 0+ | 0+ | Returned for most endpoints |\n| Profile | 0+ | 1 | 0 or 1 | 0 | Returned in [`people.get`](/people/api/rest/v1/people/get) when it is used to get the person [for the signed-in user](/people/v1/profiles#get_the_person_for_the_authenticated_user) or get a person for [another user's Google Account](/people/v1/read-people#get_the_person_for_a_google_account_id). |\n| Domain Contact | 0+ | 0 | 0 | 1 | Returned in [`people.listDirectoryPeople`](/people/api/rest/v1/people/listDirectoryPeople) or [`people.searchDirectoryPeople`](/people/api/rest/v1/people/searchDirectoryPeople). |\n\nOnly contact based people can be modified by mutation endpoints. Profile and\ndomain contact mutations are not supported."]]