向请求授权
您的应用向 Google AMP 网址 API 发送的每个请求都需要向 Google 标识您的应用。使用应用的 API 密钥识别您的应用。
获取并使用 API 密钥
API 密钥必须随请求一起发送到 Google AMP 网址 API 以获取公共数据。
API 密钥用于标识您的项目,并提供 API 访问权限、配额和报告。
要获取 API 密钥,请执行以下操作:
- 打开“凭据”页面。
- 创建并使用服务器密钥。
请勿在服务器代码之外使用此密钥。
例如,不要将其嵌入到网页中。
为防止配额被盗,请限制您的密钥,以仅允许来自您的服务器来源 IP 地址的请求。
为保障 API 密钥的安全,请遵照安全使用 API 密钥的最佳做法。
在您获得 API 密钥后,您的应用便可将查询参数 key=yourAPIKey
附加到所有请求网址。
API 密钥可以安全地嵌入网址中,而无需进行任何编码。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-08-30。
[null,null,["最后更新时间 (UTC):2023-08-30。"],[[["Every request sent to the Google AMP URL API must identify your application using an API key."],["Obtain an API key through the Google Developers Console, specifically a Server key, and restrict its usage to your server's IP addresses for security."],["Include your API key in all request URLs as a query parameter (`key=yourAPIKey`), which is safe for embedding without encoding."]]],["To interact with the Google AMP URL API, obtain an API key from the Credentials page. Create a Server key and restrict it to your server's IP addresses for security. Append the `key=`yourAPIKey parameter to all request URLs. This key identifies your project, grants API access, and provides quota and reports. Do not embed the key outside of server code, as it's designed for server-side use. Refer to the linked best practices for securely managing your API key.\n"]]