准备使用 People API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在开始编写您的第一个客户端应用之前,您需要完成三项工作:
- 获取 Google 账号
- 创建项目
- 设置应用
本指南将引导您完成这些任务(如果您尚未完成)。
1. 获取 Google 账号
您需要拥有一个 Google 帐号才能在 Google API 控制台中创建项目。如果您已经有帐号了,那就大功告成了。您可能还需要使用一个单独的 Google 帐号进行测试。
2. 为客户端创建一个项目
在向 People API 发送请求之前,您需要告知 Google 您的客户端并激活对该 API 的访问权限。为此,您可以使用 Google API 控制台创建一个项目(这是设置和 API 访问信息的指定集合),并注册您的应用。
如需开始使用 People API,您需要先使用设置工具,该工具会引导您在 Google API 控制台中创建项目、启用该 API 以及创建凭据。
3. 设置应用
如果您使用的是某种受支持的语言,不妨考虑使用其中一种客户端库。您必须先设置授权,然后才能向 API 发出请求。
请查看快速入门示例代码,其中介绍了如何获取各种语言的联系人列表。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eTo begin coding your client application, you must first obtain a Google Account, create a project in the Google API Console, and set up your app.\u003c/p\u003e\n"],["\u003cp\u003eCreating a project involves informing Google about your client and activating API access using the Google API Console, where you can register your application and manage settings.\u003c/p\u003e\n"],["\u003cp\u003eBefore making requests to the API, ensure you've set up authorization and consider utilizing client libraries if your language is supported.\u003c/p\u003e\n"]]],["To start coding, you must first obtain a Google Account. Then, use the Google API Console to create a project, which involves registering your application and enabling API access via the setup tool. Finally, set up your application, potentially using a client library and ensuring proper authorization before making API requests. Sample code is available to demonstrate fetching a list of contacts in various languages.\n"],null,["# Get Ready to Use the People API\n\nBefore you can start coding your first client application, you need to do three\nthings:\n\n1. Get a Google Account\n2. Create a project\n3. Set up your app\n\nThis guide walks you through those tasks, if you haven't done them already.\n\n1. Get a Google Account\n-----------------------\n\nYou need a [Google Account](https://www.google.com/accounts/NewAccount) in order\nto [create a project](#project) in the Google API Console. If you already have\nan account, then you're all set. You may also want a separate Google Account for\ntesting purposes.\n\n2. Create a project for your client\n-----------------------------------\n\nBefore you can send requests to the People API, you need to tell Google\nabout your client and activate access to the API. You do this by using the Google API Console to create a project, which is a named collection of\nsettings and API access information, and register your application.\n\nTo get started using People API, you need to first\n[use\nthe setup tool](https://console.cloud.google.com/start/api?id=people.googleapis.com&credential=client_key), which guides you through creating a project in the\nGoogle API Console, enabling the API, and creating credentials.\n\n3. Set up your app\n------------------\n\nIf you are using one of the supported languages, consider using one of the\n[client libraries](/people/v1/libraries). Before you can make requests to the\nAPI, you must set up [authorization](/people/v1/how-tos/authorizing).\n\nTake a look at the\n[quick start sample code](https://developers.google.com/people/quickstart/js)\nwhich shows you how to fetch a list of contacts in a variety of languages."]]