นอกเหนือจากโควต้าการเรียก API แล้ว Merchant Center ยังบังคับใช้ขีดจำกัดอื่นๆ กับทรัพยากรด้วย ซึ่งมักจะสับสนกับโควต้า API แต่เป็นส่วนหนึ่งของขีดจำกัด Merchant Center ดูข้อมูลเพิ่มเติมได้ที่ทำความเข้าใจโควต้าใน Google Merchant Center
ขีดจำกัดผลิตภัณฑ์
หากต้องการตรวจสอบขีดจำกัดของผลิตภัณฑ์ ให้ใช้เมธอด accounts.limits.get และ accounts.limits.list
หากต้องการเรียกข้อมูลขีดจำกัดของผลิตภัณฑ์ที่เฉพาะเจาะจง เช่น หากต้องการดูโควต้า EEA ของ Google Ads ของบัญชี คุณต้องระบุรหัสบัญชีและรหัสขีดจำกัดในการเรียกใช้ accounts.limits.get
รหัสขีดจำกัดคือการรวมประเภทและขอบเขตของขีดจำกัดเข้าด้วยกัน เช่น
products~ADS_EEA สำหรับผลิตภัณฑ์ที่กำหนดเป้าหมายโฆษณาใน EEA และ
products~ADS_NON_EEA สำหรับผลิตภัณฑ์ที่กำหนดเป้าหมายโฆษณานอก EEA
ต่อไปนี้เป็นตัวอย่างคำขอเพื่อรับขีดจำกัด products~ADS_EEA สำหรับบัญชีที่ระบุ
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/limits/products~ADS_EEA
ตัวอย่างต่อไปนี้แสดงวิธีดึงข้อมูลขีดจำกัดบัญชีที่เฉพาะเจาะจง
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.quota.v1.AccountLimit;
import com.google.shopping.merchant.quota.v1.AccountLimitsServiceClient;
import com.google.shopping.merchant.quota.v1.AccountLimitsServiceSettings;
import com.google.shopping.merchant.quota.v1.GetAccountLimitRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/**
* This class demonstrates how to get a single account limit for a given Merchant Center account.
*/
public class GetAccountLimitSample {
public static void getAccountLimit(String accountId, String limitId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
AccountLimitsServiceSettings accountLimitsServiceSettings =
AccountLimitsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (AccountLimitsServiceClient accountLimitsServiceClient =
AccountLimitsServiceClient.create(accountLimitsServiceSettings)) {
GetAccountLimitRequest request =
GetAccountLimitRequest.newBuilder()
.setName(String.format("accounts/%s/limits/%s", accountId, limitId))
.build();
System.out.println("Sending get account limit request:");
AccountLimit response = accountLimitsServiceClient.getAccountLimit(request);
System.out.println("Retrieved account limit below");
System.out.println(response);
} catch (Exception e) {
System.out.println("Failed to get account limit.");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
// The limit ID is a combination of the limit type and the scope, for example:
// `products~ADS_NON_EEA`
getAccountLimit(config.getAccountId().toString(), "products~ADS_EEA");
}
}
หากต้องการดูข้อมูลเกี่ยวกับรหัสขีดจำกัดที่ใช้ได้สำหรับบัญชีของคุณ ให้ใช้
accounts.limits.list
พร้อมตัวกรองสำหรับ type="products":
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/limits?filter=type%3D%22products%22
ตัวอย่างต่อไปนี้แสดงวิธีแสดงรายการขีดจำกัดบัญชี
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.quota.v1.AccountLimit;
import com.google.shopping.merchant.quota.v1.AccountLimitsServiceClient;
import com.google.shopping.merchant.quota.v1.AccountLimitsServiceClient.ListAccountLimitsPagedResponse;
import com.google.shopping.merchant.quota.v1.AccountLimitsServiceSettings;
import com.google.shopping.merchant.quota.v1.ListAccountLimitsRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to list account limits for a given Merchant Center account. */
public class ListAccountLimitsSample {
public static void listAccountLimits(String accountId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
AccountLimitsServiceSettings accountLimitsServiceSettings =
AccountLimitsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (AccountLimitsServiceClient accountLimitsServiceClient =
AccountLimitsServiceClient.create(accountLimitsServiceSettings)) {
ListAccountLimitsRequest request =
ListAccountLimitsRequest.newBuilder()
.setParent(String.format("accounts/%s", accountId))
.setFilter("type = \"products\"")
.build();
System.out.println("Sending list account limits request:");
ListAccountLimitsPagedResponse response =
accountLimitsServiceClient.listAccountLimits(request);
int count = 0;
// Iterates over all rows in all pages and prints the account limit in each row.
// Automatically uses the `nextPageToken` if returned to fetch all pages of data.
for (AccountLimit accountLimit : response.iterateAll()) {
System.out.println(accountLimit);
count++;
}
System.out.print("The following count of account limits were returned: ");
System.out.println(count);
} catch (Exception e) {
System.out.println("Failed to list account limits.");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listAccountLimits(config.getAccountId().toString());
}
}
ขีดจำกัดของการแสดงทรัพยากร
ขีดจำกัดต่อไปนี้อธิบายข้อจำกัดที่สำคัญสำหรับค่าสตริงและฟิลด์อาร์เรย์บางรายการภายในการแสดงทรัพยากรที่ใช้ใน Merchant API ขีดจำกัดเหล่านี้เหมือนกันสำหรับทั้ง Merchant API และฟีเจอร์ที่เกี่ยวข้องใน Merchant Center
| ทรัพยากร | ช่อง | ขีดจำกัด |
|---|---|---|
shippingsettings |
บริการจัดส่งต่อประเทศ ( กลุ่มการจัดส่งต่อบริการจัดส่ง ( ป้ายกำกับต่อกลุ่มการจัดส่ง ( ตารางย่อยต่อกลุ่มการจัดส่ง ( จำนวนแถวหรือคอลัมน์ในตารางอัตราเดียว ความยาวของป้ายกำกับการจัดส่ง |
20 20 30 100 150 100 |
จำนวนแถวหรือคอลัมน์ในตารางอัตราจะส่งผลต่อฟิลด์อาร์เรย์ต่อไปนี้
- ช่องอาร์เรย์ภายใน
rowHeadersหรือcolumnHeadersprices[]weights[]numberOfItems[]postalCodeGroupNames[]locations[]rows[]cells[]