Java クライアント ライブラリの構成

ライブラリは System.getProperty("user.home") + "/searchads360.properties" で構成ファイルを検索します。

構成ファイルの形式は、Key-Value ペアの Java Properties ファイルです。サポートされている鍵は、選択した認証フローによって異なります。

デスクトップ アプリケーションとウェブ アプリケーションのフローでサポートされているキー

デスクトップまたはウェブ アプリケーションのフローを使用している場合、サポートされているキーは次のとおりです。

# 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


構成アプローチの組み合わせ

SearchAds360Client とそのビルダーは、異なる構成戦略の組み合わせをサポートしています。たとえば、次のスニペットでプロパティ ファイルを使用してインスタンスの認証情報やその他の属性を構成できます。

SearchAds360Client searchAds360Client = SearchAds360Client.newBuilder()
    .fromPropertiesFile()
    .build();

build() を呼び出す前に、ビルダーの他の構成メソッドを使用して、実行時にさらに変更を加えることができます。

MCC アカウントとして認証する場合は、さらに次の項目を指定する必要があります。

api.searchads360.loginCustomerId --> Manager account ID (with hyphens removed).