นอกเหนือจากโควต้าการเรียก API แล้ว Merchant Center ยังบังคับใช้ขีดจำกัดอื่นๆ กับทรัพยากรด้วย โดยมักจะสับสนกับโควต้า API แต่เป็นส่วนหนึ่งของ ขีดจำกัดของ Merchant Center ดูข้อมูลเพิ่มเติมได้ที่ทำความเข้าใจโควต้าใน Google Merchant Center
ขีดจำกัดผลิตภัณฑ์
หากต้องการตรวจสอบขีดจำกัดของผลิตภัณฑ์ ให้ใช้วิธีการ accounts.limits.get และ accounts.limits.list
หากต้องการดึงข้อมูลโควต้าผลิตภัณฑ์ที่เฉพาะเจาะจง เช่น โควต้า EEA ของโฆษณาในบัญชี คุณต้องระบุรหัสบัญชีและรหัสโควต้าในการเรียกใช้ 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[]