자바 클라이언트 라이브러리 구성

라이브러리는 System.getProperty("user.home") + "/searchads360.properties"에서 구성 파일을 찾습니다.

구성 파일의 형식은 키-값 쌍의 자바 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()를 호출하기 전에 빌더의 다른 구성 메서드를 사용하여 런타임에 추가로 변경할 수 있습니다.

관리자 계정으로 인증하는 경우 추가로 다음을 지정해야 합니다.

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