API Báo cáo Search Ads 360 mới hiện đã ra mắt. Tham gia nhóm Google
searchads-api-announcements để luôn được cập nhật về những cải tiến và bản phát hành sắp tới.
Cấu hình thư viện ứng dụng Java
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Thư viện này tìm kiếm một tệp cấu hình trong System.getProperty("user.home") + "/searchads360.properties"
.
Định dạng của tệp cấu hình là định dạng của tệp Properties Java gồm các cặp khoá-giá trị. Các khoá được hỗ trợ sẽ khác nhau tuỳ thuộc vào quy trình xác thực đã chọn.
Các khoá được hỗ trợ cho quy trình ứng dụng trên máy tính và web
Nếu bạn đang sử dụng quy trình ứng dụng máy tính hoặc web, thì các khoá được hỗ trợ sẽ như sau:
# Credential for accessing Google's OAuth servers.
# Provided by console.cloud.google.com.
api.searchads360.clientId=INSERT_CLIENT_ID_HERE
# Credential for accessing Google's OAuth servers.
# Provided by console.cloud.google.com.
api.searchads360.clientSecret=INSERT_CLIENT_SECRET_HERE
# Renewable OAuth credential associated with 1 or more Search Ads accounts.
api.searchads360.refreshToken=INSERT_REFRESH_TOKEN_HERE
# Required for manager accounts only: Specify the login customer ID used to
# authenticate API calls. This will be the customer ID of the authenticated
# manager account. You can also specify this later in code if your application
# uses multiple manager account + OAuth pairs.
#
# api.searchads360.loginCustomerId=INSERT_LOGIN_CUSTOMER_ID_HERE
Kết hợp các phương pháp định cấu hình
SearchAds360Client
và trình tạo của nó hỗ trợ kết hợp nhiều chiến lược cấu hình. Ví dụ: bạn có thể sử dụng tệp thuộc tính để định cấu hình thông tin đăng nhập của phiên bản và cho các thuộc tính khác bằng cách sử dụng đoạn mã sau.
SearchAds360Client searchAds360Client = SearchAds360Client.newBuilder()
.fromPropertiesFile()
.build();
Bạn có thể thực hiện các thay đổi khác trong thời gian chạy bằng cách sử dụng các phương thức định cấu hình khác của trình tạo trước khi gọi build()
.
Nếu đang xác thực dưới dạng tài khoản người quản lý, bạn cũng phải chỉ định:
api.searchads360.loginCustomerId --> Manager account ID (with hyphens removed).
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-09-03 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-09-03 UTC."],[[["\u003cp\u003eThe Search Ads 360 API uses a configuration file located at \u003ccode\u003eSystem.getProperty("user.home") + "/searchads360.properties"\u003c/code\u003e to store essential settings like client ID, client secret, and refresh token.\u003c/p\u003e\n"],["\u003cp\u003eThis configuration file follows the Java Properties file format and supports different keys based on the authentication method, such as desktop, web, or service application flows.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can combine configuration approaches, using the properties file for credentials and then further customizing the client using builder methods.\u003c/p\u003e\n"],["\u003cp\u003eWhen authenticating as a manager account, you need to specify the \u003ccode\u003eapi.searchads360.loginCustomerId\u003c/code\u003e in the configuration file or during client initialization.\u003c/p\u003e\n"],["\u003cp\u003eOAuth refresh tokens required for authentication can be generated using the provided user credential generation script or the OAuth Playground utility.\u003c/p\u003e\n"]]],["The library utilizes a configuration file located at `user.home/searchads360.properties`, formatted as key-value pairs. For desktop/web flows, required keys include `api.searchads360.clientId`, `api.searchads360.clientSecret`, and `api.searchads360.refreshToken`. Manager accounts also need `api.searchads360.loginCustomerId`. An OAuth refresh token can be generated via a provided script or the OAuth Playground. Configurations can be combined using the `SearchAds360Client` builder, which allows file-based configuration and runtime modifications.\n"],null,["# Java client library configuration\n\nThe library looks for a configuration file in\n`System.getProperty(\"user.home\") + \"/searchads360.properties\"`.\n\nThe format of the configuration file is that of a Java\n[Properties](//docs.oracle.com/javase/tutorial/essential/environment/properties.html)\nfile of key value pairs. The supported keys vary depending on the chosen\nauthentication flow.\n\nSupported keys for desktop and web application flows\n----------------------------------------------------\n\nIf you are using the [desktop or web](/search-ads/reporting/quickstart/quickstart-guide#create_oauth2_credentials) application flow, the supported keys\nare as follows: \n\n # Credential for accessing Google's OAuth servers.\n # Provided by console.cloud.google.com.\n api.searchads360.clientId=INSERT_CLIENT_ID_HERE\n\n # Credential for accessing Google's OAuth servers.\n # Provided by console.cloud.google.com.\n api.searchads360.clientSecret=INSERT_CLIENT_SECRET_HERE\n\n # Renewable OAuth credential associated with 1 or more Search Ads accounts.\n api.searchads360.refreshToken=INSERT_REFRESH_TOKEN_HERE\n\n # Required for manager accounts only: Specify the login customer ID used to\n # authenticate API calls. This will be the customer ID of the authenticated\n # manager account. You can also specify this later in code if your application\n # uses multiple manager account + OAuth pairs.\n #\n # api.searchads360.loginCustomerId=INSERT_LOGIN_CUSTOMER_ID_HERE\n\n\n| **Note:** You can generate an OAuth refresh token by running the provided [user credential generation script](/search-ads/reporting/sample-code/generate-user-credentials) or by using the [OAuth Playground](/search-ads/reporting/concepts/oauth-playground) utility.\n\nCombining configuration approaches\n----------------------------------\n\nThe `SearchAds360Client` and its builder support combining different configuration\nstrategies. For example, you can use a properties file to configure the\ncredentials of the instance and for other attributes using\nthe following snippet. \n\n SearchAds360Client searchAds360Client = SearchAds360Client.newBuilder()\n .fromPropertiesFile()\n .build();\n\nYou can make further changes at runtime using the builder's other configuration\nmethods before calling `build()`.\n\nIf you are authenticating as a manager account, additionally you must\nspecify: \n\n api.searchads360.loginCustomerId --\u003e Manager account ID (with hyphens removed)."]]