Limity Merchant Center

Oprócz limitów wywołań interfejsu API Merchant Center nakłada inne limity dotyczące zasobów. Są one często mylone z limitami API, ale stanowią część limitów Merchant Center. Więcej informacji znajdziesz w artykule Limity w Google Merchant Center.

Limity produktów

Aby sprawdzić limity produktów, użyj accounts.limits.get i accounts.limits.list.

Aby pobrać konkretny limit produktów, np. limit reklam w EOG na koncie, musisz w wywołaniu accounts.limits.get podać identyfikator konta i identyfikator limitu. Identyfikator limitu to połączenie typu limitu i zakresu. Na przykład products~ADS_EEA w przypadku produktów kierowanych na reklamy w EOG i products~ADS_NON_EEA w przypadku produktów kierowanych na reklamy poza EOG.

Oto przykładowe żądanie pobrania limitu products~ADS_EEA dla danego konta:

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/limits/products~ADS_EEA

Poniższy przykład pokazuje, jak pobrać konkretny limit konta:

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");
  }
}

Aby dowiedzieć się, jakie identyfikatory limitów są dostępne na Twoim koncie, użyj accounts.limits.list z filtrem type="products":

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/limits?filter=type%3D%22products%22

Poniższy przykład pokazuje, jak wyświetlić listę limitów na koncie:

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());
  }
}

Limity reprezentacji zasobów

Poniższe limity opisują istotne ograniczenia dotyczące niektórych wartości ciągów znaków i pól tablic w reprezentacjach zasobów używanych w Merchant API. Te limity są takie same w przypadku Merchant API i odpowiadających im funkcji w Merchant Center.

Zasób Pole Limit
shippingsettings

Usługi dostawy na kraj (services).

Grupy dostawy na usługę dostawy (rateGroups).

Etykiety na grupę dostawy (applicableShippingLabels).

Podtabele na grupę dostawy (subtables).

Liczba wierszy lub kolumn w pojedynczej tabeli stawek.

Długość etykiet wysyłki.

20

20

30

100

150

100

Liczba wierszy lub kolumn w tabeli stawek wpływa na te pola tablicy:

  • Pola tablicy w elementach rowHeaders lub columnHeaders:
    • prices[]
    • weights[]
    • numberOfItems[]
    • postalCodeGroupNames[]
    • locations[]
    • rows[]
    • cells[]