محدودیت‌های مرکز تجاری

فراتر از سهمیه‌های فراخوانی API، مرکز فروشندگان محدودیت‌های دیگری را بر منابع اعمال می‌کند. این محدودیت‌ها اغلب با سهمیه‌های API اشتباه گرفته می‌شوند، اما بخشی از محدودیت‌های مرکز فروشندگان هستند. برای اطلاعات بیشتر، به درک سهمیه‌ها در مرکز فروشندگان گوگل مراجعه کنید.

محدودیت‌های محصول

برای بررسی محدودیت‌های محصول، از متدهای 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

مثال زیر نحوه بازیابی محدودیت حساب خاص را نشان می‌دهد:

جاوا

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

نمونه زیر نحوه فهرست کردن محدودیت‌های حساب را نشان می‌دهد:

جاوا

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

خدمات حمل و نقل در هر کشور ( services ).

گروه‌های حمل و نقل به ازای هر سرویس حمل و نقل ( rateGroups ).

برچسب‌ها به ازای هر گروه حمل و نقل (برچسب‌های حمل و applicableShippingLabels ).

زیرجدول‌ها به ازای هر گروه حمل و نقل ( subtables ).

تعداد ردیف‌ها یا ستون‌ها در یک جدول نرخ واحد.

طول برچسب‌های حمل و نقل.

۲۰

۲۰

۳۰

۱۰۰

۱۵۰

۱۰۰

تعداد ردیف‌ها یا ستون‌های جدول نرخ، فیلدهای آرایه‌ای زیر را تحت تأثیر قرار می‌دهد:

  • فیلدهای آرایه درون rowHeaders یا columnHeaders :
    • prices[]
    • weights[]
    • numberOfItems[]
    • postalCodeGroupNames[]
    • locations[]
    • rows[]
    • cells[]