Google Ads API に関するフィードバックをお寄せいただけますか?
登録して、ユーザー調査へのご参加をお待ちください。
省略可能なリクエスト ヘッダー
リクエスト メソッドでオプション フィールドを使用する場合は、リクエスト メッセージをメソッドの外部で作成し、単一のパラメータとして渡す必要があります。
省略可能なリクエスト ヘッダー(GoogleAdsService.Search
メソッドの validate_only
ヘッダーなど)は、メソッド シグネチャにキーワード パラメータとして存在しないため、リクエスト メッセージに直接設定する必要があります。
リクエスト オブジェクト フィールドが必須か省略可能かを判断するには、サービスのプロトコブ定義を参照し、アノテーション [(google.api.field_behavior) =
REQUIRED]
を含むフィールドを探します。
GoogleAdsService.Search
リクエストで省略可能な validate_only
フィールドを設定する例を次に示します。
request = client.get_type("SearchGoogleAdsRequest")
request.customer_id = customer_id
request.query = query
request.validate_only = True
response = googleads_service.search(request=request)
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-03-04 UTC。
[null,null,["最終更新日 2025-03-04 UTC。"],[[["When using optional fields in Google Ads API requests, construct the request message separately and pass it as a single parameter to the method."],["Optional request headers like `validate_only` are set directly on the request message, not as keyword parameters in the method signature."],["You can identify required or optional request fields by checking the protobuf definitions and looking for the `[(google.api.field_behavior) = REQUIRED]` annotation."],["To use optional fields, create an instance of the request message type, populate its fields including the optional ones, and then pass it to the API method."]]],[]]