การกําหนดค่าไลบรารีของไคลเอ็นต์ Java

ไลบรารีจะค้นหาไฟล์การกำหนดค่าใน System.getProperty("user.home") + "/searchads360.properties"

รูปแบบไฟล์ของไฟล์การกำหนดค่าจะเป็นไฟล์พร็อพเพอร์ตี้ Java ของคู่คีย์-ค่า คีย์ที่รองรับจะแตกต่างกันไปตามขั้นตอนการตรวจสอบสิทธิ์ที่เลือกไว้

คีย์ที่รองรับขั้นตอนในเดสก์ท็อปและเว็บแอปพลิเคชัน

หากคุณใช้ขั้นตอนของแอปพลิเคชันเดสก์ท็อปหรือเว็บ คีย์ที่รองรับมีดังนี้

# 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).