您正在查看 Google Photos Library API 的旧版文档。
示例
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以从 GitHub 上的 Google 相册示例代码库中获取 Google Photos Library API 的示例。此外,您还可以在本开发者指南的每个页面上找到代码段。
GitHub 上的示例
GitHub 代码库的示例展示了如何使用 Node.js,以及在线上相框模式中实现 Library API 的搜索和列表功能。
每个客户端库的 GitHub 代码库均包含多个示例,这些示例展示了如何在不同语言中使用 Library API。
问题排查
如果您在使用示例时遇到问题,请确保已完成以下操作:
需要将 OAuth 凭据添加到示例项目中。如需了解详情,请参阅 README 文件。
`
开发者指南中的代码段
开发者指南中的每个页面都包含一些代码段和 REST 调用,这些代码段和 REST 调用展示了 API 的特定功能。下面列出了一些与功能相关的指南:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eComprehensive Google Photos Library API samples are available in the \u003ca href=\"https://github.com/googlesamples/google-photos\"\u003eGoogle Photos sample repository\u003c/a\u003e on GitHub and as code snippets throughout this developer's guide.\u003c/p\u003e\n"],["\u003cp\u003eThe GitHub samples demonstrate API functionality through an online photo frame application using Node.js and offer examples in various programming languages within individual client library repositories.\u003c/p\u003e\n"],["\u003cp\u003eThis guide features code snippets and REST calls on each page, illustrating specific API features such as album management, library content listing, and media searching with filters.\u003c/p\u003e\n"],["\u003cp\u003eBefore running samples, ensure you've set up a Google Developer's project, enabled the API, and configured OAuth credentials as detailed in the setup instructions.\u003c/p\u003e\n"]]],["The Google Photos Library API offers samples in two locations: a GitHub repository and the developer's guide. The GitHub repository provides a Node.js sample demonstrating search and listing functionalities, and client library repositories offer samples in multiple languages. The developer's guide includes code snippets and REST calls for features like managing albums, listing content, and searching/filtering media. To use the samples, users must set up a Google Developer's project, enable the API, and configure OAuth credentials.\n"],null,["# Samples for the Google Photos Library API are available from the [Google Photos sample\nrepository](https://github.com/googlesamples/google-photos) on GitHub. In\naddition, you can find code snippets on each page of this developer's guide.\n\nSamples on GitHub\n-----------------\n\nThe [GitHub repository](https://github.com/googlesamples/google-photos) contains\na sample that shows the search and list functionality of the Library API\nas implemented in an online photo frame using Node JS.\n\nThe [GitHub repositories for each client\nlibrary](/photos/library/guides/client-libraries) contain multiple samples that\nshow how to use the Library API in different languages.\n\n### Troubleshooting\n\nIf you're having trouble using the samples, make sure that you've done the\nfollowing:\n\n- Set up a Google Developer's project.\n- [Enabled the API](/photos/library/guides/get-started#enable-the-api).\n- [Set up OAuth credentials](/photos/library/guides/get-started#request-id).\n\nThe OAuth credentials need to be added to the sample project. For details, see\nthe README.\n\\`\n\nCode snippets in the developer's guide\n--------------------------------------\n\nEach page in the developer's guide includes code snippets and REST calls that\nillustrate particular features of the API. Some of the guides available for\nfeatures include the following:\n\n- [Managing albums](/photos/library/guides/manage-albums)\n- [Listing library contents, albums, and media\n items](/photos/library/guides/list)\n- [Searching media and applying filters](/photos/library/guides/apply-filters)"]]