适用于 Java 的 Google Ads API 客户端库
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Java 版客户端库托管在 GitHub 上,并通过 Maven 进行分发。它提供了多项功能来帮助您使用该 API,包括更轻松地管理凭据和创建 Google Ads API 服务客户端。
该库需要 Java 1.8 及更高版本。
video_library
视频库:Java 客户端库入门
指南
- 开始使用
- 库的设置说明。
- 授权
有关使用不同授权流程为库配置 OAuth2 凭据的说明。
- OAuth 桌面应用流程
- 如何为桌面应用获取 OAuth2 刷新令牌。
- OAuth Web 应用流程
- 如何获取 Web 应用的 OAuth2 刷新令牌。
- OAuth 服务账号流程
- 如何将 OAuth2 与服务账号凭据搭配使用。
- 从源代码构建
如何从源代码构建客户端库。
- 配置文件格式
如何指定 Java 属性。
- 日志记录
如何设置日志记录。
- 字段掩码
如何在更新操作中使用字段掩码。
- 资源名称
API 中资源名称的格式和用法。
- 代理配置
配置 HTTP(S) 代理。
- 长时间运行的操作
运行长时间运行的操作。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-26。
[null,null,["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eThe Google Ads API client library for Java is open-source, available on GitHub, and distributed via Maven for easy integration into your projects.\u003c/p\u003e\n"],["\u003cp\u003eIt simplifies interactions with the Google Ads API, offering features like credential management and service client creation, while requiring Java 1.8+ for compatibility.\u003c/p\u003e\n"],["\u003cp\u003eComprehensive guides and documentation are available to assist with setup, authorization using various OAuth flows, building from source, and other library functionalities.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage resources for advanced usage including configuration files, logging, field masks, resource names, proxy settings, and managing long-running operations.\u003c/p\u003e\n"],["\u003cp\u003eA dedicated video library provides a visual guide to get started with the Java client library and its core features.\u003c/p\u003e\n"]]],[],null,["# Google Ads API Client Library for Java\n\nThe client library for Java is [hosted on\nGitHub](https://github.com/googleads/google-ads-java) and\n[distributed](//search.maven.org/artifact/com.google.api-ads/google-ads)\nthrough [Maven](//maven.apache.org/). It offers several features to help you use\nthe API, including easier management of credentials and creation of Google Ads API\nservice clients.\n\nThe library requires Java 1.8+.\n\n\nvideo_library\n[Video library: Getting started with the Java client library](https://www.youtube.com/playlist?list=PLKByxjzUC-N9gWKMqpi5S0WIVc4o_Ukdj)\n\nGuides\n------\n\n[Getting started](/google-ads/api/docs/client-libs/java/getting-started)\n: Setup instructions for the library.\n\nAuthorization\n\n: Instructions on configuring OAuth2 credentials for the library using\n different authorization flows.\n\n [OAuth desktop application flow](/google-ads/api/docs/client-libs/java/oauth-desktop)\n : How to get OAuth2 refresh tokens for desktop apps.\n\n [OAuth web application flow](/google-ads/api/docs/client-libs/java/oauth-web)\n : How to get OAuth2 refresh tokens for web apps.\n\n [OAuth service account flow](/google-ads/api/docs/client-libs/java/oauth-service)\n : How to use OAuth2 with service account credentials.\n\n[Build from source](/google-ads/api/docs/client-libs/java/build-from-source)\n\n: How to build the client library from source.\n\n[Configuration file format](/google-ads/api/docs/client-libs/java/config-file)\n\n: How to specify Java properties.\n\n[Logging](/google-ads/api/docs/client-libs/java/logging)\n\n: How to set up logging.\n\n[Field masks](/google-ads/api/docs/client-libs/java/field-masks)\n\n: How to use field masks in update operations.\n\n[Resource names](/google-ads/api/docs/client-libs/java/resource-names)\n\n: Form and usage of resource names in the API.\n\n[Proxy configuration](/google-ads/api/docs/client-libs/java/proxy)\n\n: Configure a HTTP(S) proxy.\n\n[Long-running operations](/google-ads/api/docs/client-libs/java/lro)\n\n: Run long-running operations."]]