Границы торгового центра

Помимо квот на вызовы API, Merchant Center устанавливает и другие ограничения на ресурсы. Их часто путают с квотами API, но они являются частью ограничений Merchant Center. Для получения дополнительной информации см. раздел «Понимание квот в Google Merchant Center» .

Ограничения на продукцию

Для проверки лимитов на количество товаров используются методы accounts.limits.get и accounts.limits.list .

Чтобы получить информацию о конкретном лимите для продукта, например, о квоте Ads EEA для аккаунта, необходимо указать идентификатор аккаунта и идентификатор лимита в вызове метода accounts.limits.get . Идентификатор лимита представляет собой комбинацию типа лимита и области действия. Например, products~ADS_EEA для продуктов, ориентированных на рекламу в ЕЭЗ, и products~ADS_NON_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

Услуги доставки по странам ( services ).

Группы доставки по каждой службе доставки ( rateGroups ).

Этикетки для каждой группы доставки ( applicableShippingLabels ).

Подтаблицы по группам отгрузок ( subtables ).

Количество строк или столбцов в одной таблице тарифов .

Длина транспортных этикеток.

20

20

30

100

150

100

Количество строк или столбцов в таблице тарифов влияет на следующие поля массива:

  • Поля-массивы внутри rowHeaders или columnHeaders :
    • prices[]
    • weights[]
    • numberOfItems[]
    • postalCodeGroupNames[]
    • locations[]
    • rows[]
    • cells[]