Помимо квот на вызовы API, в Merchant Center действуют и другие ограничения на ресурсы. Их часто путают с квотами API, но они относятся к ограничениям Merchant Center. Подробнее о квотах в Google Merchant Center…
Ограничение на количество товаров
Чтобы проверить лимиты на продукты, используйте методы accounts.limits.get и accounts.limits.list.
Чтобы получить определенный лимит продукта, например квоту на рекламу в ЕЭЗ для аккаунта, нужно указать идентификатор аккаунта и идентификатор лимита в вызове 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 |
Службы доставки на страну ( Группы доставки на службу доставки ( Ярлыки на группу доставки ( Дополнительные таблицы на группу доставки ( Число строк или столбцов в таблице тарифов. Длина транспортных этикеток. |
20 20 30 100 150 100 |
Количество строк и столбцов в таблице тарифов определяется следующими полями массива:
- Поля массива в
rowHeadersилиcolumnHeaders:prices[]weights[]numberOfItems[]postalCodeGroupNames[]locations[]rows[]cells[]