Çok Kanallı Ayarları Yönetme

Omnichannel Settings API, yerel envanter reklamları (YER) ve ücretsiz yerel listelemeler (ÜYL) programlarınızı yapılandırmak için giriş noktasıdır.

Bu API'yi kullanarak programatik olarak:

  • Çok kanallı ayarları yönetme (oluşturma ve güncelleme)
  • Çok Kanallı Ayarları Getirme (Alma ve Listeleme)
  • Uygun satıcılar için envanter doğrulaması isteme

Daha fazla bilgi için Yerel envanter reklamlarına ve ücretsiz yerel listelemelere genel bakış başlıklı makaleyi inceleyin.

Ön koşullar

Şunlara sahip olmanız gerekir:

  • Merchant Center hesabı

  • İşletme Profili oluşturun. Hesabınız yoksa oluşturabilirsiniz. İşletme Profili'ne kaydolma başlıklı makaleyi inceleyin.

  • İşletme Profiliniz ile Merchant Center hesabınız arasında bağlantı oluşturulur. Bağlantıyı oluşturmak için Merchant Center kullanıcı arayüzünü veya Merchant API'yi kullanabilirsiniz (Google İşletme Profili bağlama başlıklı makaleyi inceleyin).

Çok kanallı ayar oluşturma

Çok kanallı ayar oluşturmak için omnichannelSettings.create yöntemini kullanabilirsiniz. Oluşturma yöntemi, giriş olarak bir omnichannelSetting kaynağı alır ve başarılı olursa oluşturulan çok kanallı ayarı döndürür.

Oluştururken hem regionCode hem de LsfType alanlarını doldurmanız gerekir:

  • OmnichannelSetting, ülke bazında uygulanır. RegionCode, hedeflenen ülkeyi tanımlar. Oluşturulduktan sonra bunu değiştiremezsiniz. RegionCode, Common Locale Data Repository (CLDR) projesi tarafından tanımlanan adlandırma kuralına uymalıdır.
  • LsfType, ürün sayfanıza bağlıdır. Ayrıntılı bilgi için LsfType başlıklı makaleyi inceleyin.

Daha fazla bilgi için Yerel envanter reklamlarınız için ürün sayfası deneyimini değiştirme başlıklı makaleyi inceleyin.

Oluşturma aşamasında tüm alanları doldurmanız gerekmez. Bu alanları daha sonra yapılandırabilirsiniz. Mevcut bir omnichannelSetting ayarını güncellemek için Çok kanallı ayarı güncelleme başlıklı makaleyi inceleyin.

MHLSF_BASIC seçeneğini belirleyip inStock kaydolduğunuzda gönderilecek örnek bir istek aşağıda verilmiştir:

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

{
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "inStock": {
      "uri": {URI}"
  }
}

Aşağıdakini değiştirin:

  • {ACCOUNT_ID}: Merchant Center hesabınızın benzersiz tanımlayıcısı
  • {REGION_CODE}: CLDR tarafından tanımlanan bölge kodu
  • {URI}: Belirli bir yorum için kullanılan geçerli bir URI. Uygun olmayan bir URI, onayı engelleyebilir.

İstek başarıyla çalıştırıldıktan sonra aşağıdaki yanıtı görürsünüz:

{
  "name": "accounts/{ACCOUNT_ID}/omnichannelSettings/{omnichannel_setting}",
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "inStock": {
      "uri": "{URI}",
      "state": "RUNNING"
  }
}

omnichannelSetting alanlarını kullanarak farklı LIA/FLL özelliklerine kaydolmak, genellikle birkaç saat ile birkaç gün arasında süren manuel incelemeleri tetikler. Uygun olmayan veriler nedeniyle gereksiz bekleme süresinden kaçınmak için girişlerinizi tekrar kontrol etmenizi öneririz.

Yeni oluşturduğunuz çok kanallı ayarı görüntülemek veya incelemelerin durumunu kontrol etmek için ülkeyi belirterek accounts.omnichannelSettings.get ya da accounts.omnichannelSettings.list yöntemini kullanın.

Yerel Vitrin (LSF) Türü

Kullanmayı planladığınız ürün sayfasına göre bir LsfType seçin:

Ürün sayfası türü LsfType Enum değeri
Mağaza stok durumunu içeren ürün sayfaları Satıcı Üzerinde Yerel Vitrin (Temel) MHLSF_BASIC
Stok durumu ve fiyat bilgilerini içeren, mağazaya özel ürün sayfaları Satıcı Üzerinde Yerel Vitrin (Tam) MHLSF_FULL
Mağaza stok durumunu içermeyen ürün sayfaları Google Tarafından Barındırılan Yerel Vitrin (GHLSF) GHLSF

Satıcı üzerinde yerel vitrin türlerini seçerseniz inStock veya pickup özelliklerinden en az biri için URI alanını da doldurmanız gerekir.

InStock

Ürün sayfanız hakkında daha fazla bilgi sağlamak için InStock'u kullanabilirsiniz.

Satıcı üzerinde yerel mağaza sayfası türlerini seçer ve InStock'ta URI alanını belirtirseniz stokta bulunan ürünleri sunma niyetinizi göstermiş olursunuz. Sağlanan URI'ye göre bir inceleme başlatırız.

GHLSF türünü seçerseniz istekte boş bir InStock alanı sağlamanız gerekir. Satıcı tarafından barındırılan yerel mağaza vitrini türlerinin aksine, ilk katılımı tamamlamak için envanter doğrulama sürecini tamamlamanız gerekir.

Bu kod örneği, GHLSF ile bir omnichannelSetting oluşturur:

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.CreateOmnichannelSettingRequest;
import com.google.shopping.merchant.accounts.v1.InStock;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting.LsfType;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to create an omnichannel setting for a given Merchant Center account
 * in a given country
 */
public class CreateOmnichannelSettingSample {

  public static void createOmnichannelSetting(Config config, String regionCode) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the credentials retrieved above.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

      // Creates an omnichannel setting with GHLSF type in the given country.
      CreateOmnichannelSettingRequest request =
          CreateOmnichannelSettingRequest.newBuilder()
              .setParent(parent)
              .setOmnichannelSetting(
                  OmnichannelSetting.newBuilder()
                      .setRegionCode(regionCode)
                      .setLsfType(LsfType.GHLSF)
                      .setInStock(InStock.getDefaultInstance())
                      .build())
              .build();

      System.out.println("Sending create omnichannel setting request:");
      OmnichannelSetting response =
          omnichannelSettingsServiceClient.createOmnichannelSetting(request);

      System.out.println("Inserted Omnichannel Setting below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";

    createOmnichannelSetting(config, regionCode);
  }
}

PHP

use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\CreateOmnichannelSettingRequest;
use Google\Shopping\Merchant\Accounts\V1\InStock;
use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting;
use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting\LsfType;

/**
 * This class demonstrates how to create an omnichannel setting for a given
 * Merchant Center account in a given country.
 */
class CreateOmnichannelSetting
{
    /**
     * Helper to create the parent string.
     *
     * @param string $accountId The merchant account ID.
     * @return string The parent string in the format `accounts/{account}`.
     */
    private static function getParent(string $accountId): string
    {
        return sprintf('accounts/%s', $accountId);
    }

    /**
     * Creates an omnichannel setting for a given Merchant Center account.
     *
     * @param array $config The configuration file for authentication.
     * @param string $regionCode The country for the omnichannel setting.
     */
    public static function createOmnichannelSettingSample(
        array $config,
        string $regionCode
    ): void {
        // Obtains OAuth credentials from the configuration file.
        $credentials = Authentication::useServiceAccountOrTokenFile();

        // Creates a client.
        $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
            'credentials' => $credentials
        ]);

        // Constructs the parent resource name.
        $parent = self::getParent($config['accountId']);

        // Creates the omnichannel setting with GHLSF type in the given country.
        $omnichannelSetting = new OmnichannelSetting([
            'region_code' => $regionCode,
            'lsf_type' => LsfType::GHLSF,
            'in_stock' => new InStock()
        ]);

        // Creates the request.
        $request = new CreateOmnichannelSettingRequest([
            'parent' => $parent,
            'omnichannel_setting' => $omnichannelSetting
        ]);

        // Calls the API and prints the response.
        try {
            printf("Sending create omnichannel setting request:%s", PHP_EOL);
            $response = $omnichannelSettingsServiceClient->createOmnichannelSetting($request);
            printf("Inserted Omnichannel Setting below:%s", PHP_EOL);
            print $response->serializeToJsonString(true) . PHP_EOL;
        } catch (ApiException $e) {
            printf("An error has occured: %s", $e->getMessage());
        }
    }

    /**
     * Executes the sample.
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        // The country which you're targeting.
        $regionCode = '{REGION_CODE}';
        self::createOmnichannelSettingSample($config, $regionCode);
    }
}

// Runs the script.
$sample = new CreateOmnichannelSetting();
$sample->callSample();

Python

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import CreateOmnichannelSettingRequest
from google.shopping.merchant_accounts_v1 import InStock
from google.shopping.merchant_accounts_v1 import OmnichannelSetting
from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient


def create_omnichannel_setting(account_id: str, region_code: str) -> None:
  """Creates an omnichannel setting for a given Merchant Center account.

  Args:
      account_id: The ID of the Merchant Center account.
      region_code: The country for which you're creating the setting.
  """
  # Gets OAuth Credentials.
  credentials = generate_user_credentials.main()

  # Creates a client.
  client = OmnichannelSettingsServiceClient(credentials=credentials)

  # The parent account under which to create the setting.
  parent = f"accounts/{account_id}"

  # Creates an omnichannel setting with GHLSF type in the given country.
  omnichannel_setting = OmnichannelSetting()
  omnichannel_setting.region_code = region_code
  omnichannel_setting.lsf_type = OmnichannelSetting.LsfType.GHLSF
  omnichannel_setting.in_stock = InStock()

  # Creates the request.
  request = CreateOmnichannelSettingRequest(
      parent=parent, omnichannel_setting=omnichannel_setting
  )

  # Makes the request and catches and prints any error messages.
  try:
    print("Sending create omnichannel setting request:")
    response = client.create_omnichannel_setting(request=request)
    print("Inserted Omnichannel Setting below:")
    print(response)
  except RuntimeError as e:
    print("An error has occured: ")
    print(e)


if __name__ == "__main__":
  # The ID of the account to get the omnichannel settings for.
  _ACCOUNT = configuration.Configuration().read_merchant_info()

  # The country which you're targeting.
  _REGION_CODE = "{REGION_CODE}"

  create_omnichannel_setting(_ACCOUNT, _REGION_CODE)

Teslim alma

Mağaza stok durumunun yanı sıra, mağazadaki ürünlerinizi teslim alma özelliğiyle de zenginleştirebilirsiniz. Bu özellik yalnızca satıcı üzerinde yerel mağaza sayfası türleri için uygundur.

Bir ürünün teslim alma için işaretlenmesi, müşterinin ürünü internetten satın alıp mağazadan teslim alabileceği anlamına gelir. Pickup alanını ayarlayarak ürünleri teslim alma HDS'si ile sunma niyetinizi gösterirsiniz. Sağlanan URI'ye göre bir inceleme başlatacağız.

Pickup ile omnichannel ayarı oluşturan örnek bir istek aşağıda verilmiştir:

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

{
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "pickup": {
     "uri: "{URI}"
  }
}

Sipariş için teşhirde

Siparişle temin edilen teşhir ürünü özelliğini kullanarak fiziksel mağazanızda sergilenen ancak hemen satın almaya uygun olmayan ürünleri gösterebilirsiniz. Örneğin, büyük mobilyalar:

  • Google'da benzer ürünleri arayan müşteriler, arama sonuçlarında bu reklamları "mağazada" ek açıklamasıyla görür.
  • Google Arama sonuçları sayfasında mağazaya göz atan müşteriler, bu ürünleri "Sipariş edilebilir" olarak işaretlenmiş şekilde görür.

Müşteriler, ilgili öğeyi görüntülemek için yerel envanter reklamınızı veya ücretsiz yerel listelemenizi seçebilir. Öğeyi satın almak için fiziksel mağazanızı ziyaret edebilir, öğeyi görüntüleyebilir ve ardından öğenin kendilerine veya teslim alınmak üzere mağazanıza gönderilmesini isteyebilirler.

Hakkında (Almanya, Avusturya ve İsviçre)

Avusturya ve Almanya'da reklam yayınlıyorsanız ve GHLSF seçeneğini belirlerseniz Hakkında sayfası göndermeniz gerekir.

İsviçre'de reklam yayınlıyorsanız LsfType fark etmeksizin bir "Hakkında" sayfası göndermeniz gerekir.

Hakkında sayfası URL'si doğrulanana kadar GHLSF satıcıları Google'dan manuel envanter doğrulaması isteyemez.

Bu üç ülkedeki tüm satıcılar için hizmet, Hakkında sayfanız onaylanana kadar ÜYL/YER özelliklerini etkinleştirmez.

Envanter Doğrulaması

Envanter doğrulaması yalnızca GHLSF satıcıları için zorunludur. MHLSF türleri için desteklenmez.

Ürün verilerini ve envanter verilerini eklemeden önce veya ekledikten sonra (accounts.products.localInventories.insert ya da Merchant Center kullanıcı arayüzünü kullanarak) iletişim kişinizi doğrulamanız gerekir. create veya update yöntemini kullanarak envanter doğrulama kişisi (ad ve e-posta adresi) sağlayın. İlgili kişi, Google tarafından gönderilen bir e-posta alır ve mesajdaki bir düğmeyi tıklayarak durumunu doğrulayabilir.

Bu işlemi tamamladıktan sonra Envanter doğrulaması iste'yi seçebilirsiniz. Daha fazla bilgi için Envanter doğrulaması hakkında başlıklı makaleyi inceleyin.

Doğrulama sürecinde veya doğrulama sonrasında omnichannelSetting.update kullanarak iletişim kişinizi değiştirebilirsiniz.

Bu işlem tamamlandıktan sonra Google, sağlanan bilgilerin doğruluğunu onaylar.

Çok kanallı ayar alma

Belirli bir ülkedeki omnichannelSetting yapılandırmasını almak veya yorumlarınızın mevcut durumunu kontrol etmek için omnichannelSettings.get yöntemini kullanın.

Aşağıda örnek bir istek verilmiştir:

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}

Aşağıdakini değiştirin:

  • {ACCOUNT_ID}: Merchant Center hesabınızın benzersiz tanımlayıcısı
  • {OMNICHANNEL_SETTING}: Hedef ülkenizin bölge kodu

ACTIVE durumu, yorumun onaylandığını gösterir.

Durum FAILED ise sorunları giderin ve omnichannelSetting.update yöntemini çağırarak yeni bir inceleme başlatın.

Salt okunur LFP alanı, Yerel Feed'ler İş Ortağı statünüzü gösterir. İş ortaklığına bağlantı vermek için lfpProviders.linkLfpProvider kullanın.

Durumları ve anlamlarını kontrol etme hakkında daha fazla bilgi için Çok kanallı ayarın durumunu görüntüleme başlıklı makaleyi inceleyin.

Çok Kanallı Ayarları Listeleme

Hesabınızla ilgili tüm omnichannelSetting bilgilerini almak için omnichannelSettings.list yöntemini kullanın.

Aşağıda bir kod örneği verilmiştir:

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.ListOmnichannelSettingsRequest;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient.ListOmnichannelSettingsPagedResponse;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to get the list of omnichannel settings for a given Merchant Center
 * account
 */
public class ListOmnichannelSettingsSample {

  public static void omnichannelSettings(Config config) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the credentials retrieved above.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    String accountId = config.getAccountId().toString();
    String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      ListOmnichannelSettingsRequest request =
          ListOmnichannelSettingsRequest.newBuilder().setParent(parent).build();

      System.out.println("Sending list omnichannel setting request:");
      ListOmnichannelSettingsPagedResponse response =
          omnichannelSettingsServiceClient.listOmnichannelSettings(request);

      int count = 0;

      // Iterates over all the entries in the response.
      for (OmnichannelSetting omnichannelSetting : response.iterateAll()) {
        System.out.println(omnichannelSetting);
        count++;
      }
      System.out.println(String.format("The following count of elements were returned: %d", count));
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    omnichannelSettings(config);
  }
}

PHP

use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\ListOmnichannelSettingsRequest;

/**
 * This class demonstrates how to get the list of omnichannel settings for a
 * given Merchant Center account.
 */
class ListOmnichannelSettings
{
    /**
     * Helper to create the parent string.
     *
     * @param string $accountId The merchant account ID.
     * @return string The parent string in the format `accounts/{account}`.
     */
    private static function getParent(string $accountId): string
    {
        return sprintf('accounts/%s', $accountId);
    }

    /**
     * Lists the omnichannel settings for a given Merchant Center account.
     *
     * @param array $config The configuration file for authentication.
     */
    public static function listOmnichannelSettingsSample(array $config): void
    {
        // Obtains OAuth credentials from the configuration file.
        $credentials = Authentication::useServiceAccountOrTokenFile();

        // Creates a client.
        $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
            'credentials' => $credentials
        ]);

        // Constructs the parent resource name.
        $parent = self::getParent($config['accountId']);

        // Creates the request.
        $request = new ListOmnichannelSettingsRequest(['parent' => $parent]);

        // Calls the API and prints the response.
        try {
            printf("Sending list omnichannel setting request:%s", PHP_EOL);
            $response = $omnichannelSettingsServiceClient->listOmnichannelSettings($request);

            $count = 0;
            // Iterates over all the omnichannel settings and prints them.
            foreach ($response->iterateAllElements() as $omnichannelSetting) {
                print $omnichannelSetting->serializeToJsonString(true) . PHP_EOL;
                $count++;
            }
            printf("The following count of elements were returned: %d%s", $count, PHP_EOL);
        } catch (ApiException $e) {
            printf("An error has occured: %s", $e->getMessage());
        }
    }

    /**
     * Executes the sample.
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        self::listOmnichannelSettingsSample($config);
    }
}

// Runs the script.
$sample = new ListOmnichannelSettings();
$sample->callSample();

Python

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import ListOmnichannelSettingsRequest
from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient


def list_omnichannel_settings(account_id: str) -> None:
  """Lists the omnichannel settings for a given Merchant Center account.

  Args:
      account_id: The ID of the Merchant Center account.
  """
  # Gets OAuth Credentials.
  credentials = generate_user_credentials.main()

  # Creates a client.
  client = OmnichannelSettingsServiceClient(credentials=credentials)

  # The parent account for which to list the settings.
  parent = f"accounts/{account_id}"

  # Creates the request.
  request = ListOmnichannelSettingsRequest(parent=parent)

  # Makes the request and catches and prints any error messages.
  try:
    print("Sending list omnichannel setting request:")
    response = client.list_omnichannel_settings(request=request)

    count = 0
    # Iterates over all the entries in the response.
    for omnichannel_setting in response:
      print(omnichannel_setting)
      count += 1
    print(f"The following count of elements were returned: {count}")
  except RuntimeError as e:
    print("An error has occured: ")
    print(e)


if __name__ == "__main__":
  # The ID of the account to get the omnichannel settings for.
  _ACCOUNT = configuration.Configuration().read_merchant_info()

  list_omnichannel_settings(_ACCOUNT)

Çok kanallı ayarı güncelleme

Mevcut bir çok kanallı ayarın yapılandırmasını güncellemek için omnichannelSettings.update yöntemini kullanın.

Güncelleme yapmak için istediğiniz özelliği güncelleme maskesine eklemeniz ve güncelleme isteğindeki omnichannelSetting alanında ilgili alanları doldurmanız gerekir. Bunlardan herhangi birini dilediğiniz zaman Studio'da güncelleyebilirsiniz.

  • lsfType
  • inStock
  • pickup
  • odo
  • about
  • inventoryVerification

Güncelleme maskesine dahil edilmeyen özellikler güncellenmez.

Bir özellik, güncelleme maskesine dahil edilmiş ancak istekte ayarlanmamışsa temizlenir.

Aşağıdaki kod örneğinde, envanter doğrulama alanının nasıl güncelleneceği gösterilmektedir.

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.protobuf.FieldMask;
import com.google.shopping.merchant.accounts.v1.InventoryVerification;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1.UpdateOmnichannelSettingRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to update an omnichannel setting for a given Merchant Center account
 * in a given country
 */
public class UpdateOmnichannelSettingSample {

  public static void updateOmnichannelSettings(
      Config config, String regionCode, String contact, String email) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the credentials retrieved above.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String name =
          OmnichannelSettingName.newBuilder()
              .setAccount(accountId)
              .setOmnichannelSetting(regionCode)
              .build()
              .toString();

      OmnichannelSetting omnichannelSetting =
          OmnichannelSetting.newBuilder()
              .setName(name)
              .setInventoryVerification(
                  InventoryVerification.newBuilder()
                      .setContact(contact)
                      .setContactEmail(email)
                      .build())
              .build();
      FieldMask fieldMask = FieldMask.newBuilder().addPaths("inventory_verification").build();
      UpdateOmnichannelSettingRequest request =
          UpdateOmnichannelSettingRequest.newBuilder()
              .setOmnichannelSetting(omnichannelSetting)
              .setUpdateMask(fieldMask)
              .build();

      System.out.println("Sending update omnichannel setting request:");
      OmnichannelSetting response =
          omnichannelSettingsServiceClient.updateOmnichannelSetting(request);

      System.out.println("Updated Omnichannel Setting below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";
    // The name of the inventory verification contact you want to update.
    String contact = "{NAME}";
    // The address of the inventory verification email you want to update.
    String email = "{EMAIL}";

    updateOmnichannelSettings(config, regionCode, contact, email);
  }
}

PHP

use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;
use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\InventoryVerification;
use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting;
use Google\Shopping\Merchant\Accounts\V1\UpdateOmnichannelSettingRequest;

/**
 * This class demonstrates how to update an omnichannel setting for a given
 * Merchant Center account in a given country.
 */
class UpdateOmnichannelSetting
{
    /**
     * Helper to create the name string.
     *
     * @param string $accountId The merchant account ID.
     * @param string $regionCode The region code of the setting.
     * @return string The name string in the format
     *     `accounts/{account}/omnichannelSettings/{omnichannelSetting}`.
     */
    private static function getName(string $accountId, string $regionCode): string
    {
        return sprintf('accounts/%s/omnichannelSettings/%s', $accountId, $regionCode);
    }

    /**
     * Updates an omnichannel setting for a given Merchant Center account.
     *
     * @param array $config The configuration file for authentication.
     * @param string $regionCode The country of the omnichannel setting.
     * @param string $contact The name of the inventory verification contact.
     * @param string $email The email of the inventory verification contact.
     */
    public static function updateOmnichannelSettingSample(
        array $config,
        string $regionCode,
        string $contact,
        string $email
    ): void {
        // Obtains OAuth credentials from the configuration file.
        $credentials = Authentication::useServiceAccountOrTokenFile();

        // Creates a client.
        $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
            'credentials' => $credentials
        ]);

        // Constructs the resource name.
        $name = self::getName($config['accountId'], $regionCode);

        // Creates the omnichannel setting with the updated fields.
        $omnichannelSetting = new OmnichannelSetting([
            'name' => $name,
            'inventory_verification' => new InventoryVerification([
                'contact' => $contact,
                'contact_email' => $email
            ])
        ]);

        // Creates the field mask to specify which fields to update.
        $fieldMask = new FieldMask([
            'paths' => ['inventory_verification']
        ]);

        // Creates the request.
        $request = new UpdateOmnichannelSettingRequest([
            'omnichannel_setting' => $omnichannelSetting,
            'update_mask' => $fieldMask
        ]);

        // Calls the API and prints the response.
        try {
            printf("Sending update omnichannel setting request:%s", PHP_EOL);
            $response = $omnichannelSettingsServiceClient->updateOmnichannelSetting($request);
            printf("Updated Omnichannel Setting below:%s", PHP_EOL);
            print $response->serializeToJsonString(true) . PHP_EOL;
        } catch (ApiException $e) {
            printf("An error has occured: %s", $e->getMessage());
        }
    }

    /**
     * Executes the sample.
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        // The country which you're targeting.
        $regionCode = '{REGION_CODE}';
        // The name of the inventory verification contact you want to update.
        $contact = '{NAME}';
        // The address of the inventory verification email you want to update.
        $email = '{EMAIL}';
        self::updateOmnichannelSettingSample($config, $regionCode, $contact, $email);
    }
}

// Runs the script.
$sample = new UpdateOmnichannelSetting();
$sample->callSample();

Python

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.protobuf import field_mask_pb2
from google.shopping.merchant_accounts_v1 import InventoryVerification
from google.shopping.merchant_accounts_v1 import OmnichannelSetting
from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient
from google.shopping.merchant_accounts_v1 import (
    UpdateOmnichannelSettingRequest,
)


def update_omnichannel_setting(
    account_id: str, region_code: str, contact: str, email: str
) -> None:
  """Updates an omnichannel setting for a given Merchant Center account.

  Args:
      account_id: The ID of the Merchant Center account.
      region_code: The country for which you're updating the setting.
      contact: The name of the inventory verification contact.
      email: The email of the inventory verification contact.
  """
  # Gets OAuth Credentials.
  credentials = generate_user_credentials.main()

  # Creates a client.
  client = OmnichannelSettingsServiceClient(credentials=credentials)

  # The name of the omnichannel setting to update.
  name = f"accounts/{account_id}/omnichannelSettings/{region_code}"

  # Creates an omnichannel setting with the updated values.
  omnichannel_setting = OmnichannelSetting()
  omnichannel_setting.name = name
  omnichannel_setting.inventory_verification = InventoryVerification(
      contact=contact, contact_email=email
  )

  # Creates a field mask to specify which fields to update.
  field_mask = field_mask_pb2.FieldMask(paths=["inventory_verification"])

  # Creates the request.
  request = UpdateOmnichannelSettingRequest(
      omnichannel_setting=omnichannel_setting, update_mask=field_mask
  )

  # Makes the request and catches and prints any error messages.
  try:
    print("Sending update omnichannel setting request:")
    response = client.update_omnichannel_setting(request=request)
    print("Updated Omnichannel Setting below:")
    print(response)
  except RuntimeError as e:
    print("An error has occured: ")
    print(e)


if __name__ == "__main__":
  # The ID of the account to get the omnichannel settings for.
  _ACCOUNT = configuration.Configuration().read_merchant_info()

  # The country which you're targeting.
  _REGION_CODE = "{REGION_CODE}"
  # The name of the inventory verification contact you want to update.
  _CONTACT = "{NAME}"
  # The address of the inventory verification email you want to update.
  _EMAIL = "{EMAIL}"

  update_omnichannel_setting(_ACCOUNT, _REGION_CODE, _CONTACT, _EMAIL)

Envanter doğrulaması isteme

omnichannelSettings.requestInventoryVerification yalnızca GHLSF satıcıları için geçerlidir.

Bu RPC'yi çağırmadan önce aşağıdakileri yapmış olmanız gerekir:

  • Ürün ve envanter verilerinizi yükleyin.
  • Envanter doğrulama kişisini doğrulayın.
  • Almanya, Avusturya veya İsviçre'deki satıcılar için About sayfa incelemesini tamamlayın.

Uygunluk durumunuzu belirlemek için omnichannelSettings.get numaralı telefonu arayın ve omnichannelSetting.inventoryVerification.state adresini kontrol edin. INACTIVE simgesi gösteriliyorsa omnichannelSettings.requestInventoryVerification ile görüşmeye hazırsınız demektir.

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationRequest;
import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationResponse;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to request inventory verification for a given Merchant Center account
 * in a given country
 */
public class RequestInventoryVerificationSample {

  public static void requestInventoryVerification(Config config, String regionCode)
      throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the credentials retrieved above.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String name =
          OmnichannelSettingName.newBuilder()
              .setAccount(accountId)
              .setOmnichannelSetting(regionCode)
              .build()
              .toString();
      RequestInventoryVerificationRequest request =
          RequestInventoryVerificationRequest.newBuilder().setName(name).build();

      System.out.println("Sending request inventory verification request:");
      RequestInventoryVerificationResponse response =
          omnichannelSettingsServiceClient.requestInventoryVerification(request);

      System.out.println("Omnichannel Setting after inventory verification request below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";

    requestInventoryVerification(config, regionCode);
  }
}

Çok kanallı ayarın durumunu görüntüleme

Yerel envanter reklamları ilk katılım incelemelerinin inceleme durumunu kontrol etmek için omnichannelSettings.get veya omnichannelSettings.list yöntemleri tarafından döndürülen omnichannelSetting öğesinin ilgili özellikleri için ReviewState özelliğini kontrol edin.

ReviewState alanı, envanter doğrulama süreci hariç tüm ilk katılım incelemeleri için geçerlidir ve aşağıdaki değerleri alabilir:

  • ACTIVE: Onaylandı.
  • FAILED: Reddedildi.
  • RUNNING: Hâlâ inceleniyor.
  • ACTION_REQUIRED: Bu, yalnızca GHLSF satıcıları için InStock.state içinde mevcuttur. Bu, YER'nin yayınlanması için envanter doğrulaması istemeniz gerektiği anlamına gelir.

InventoryVerification.State aşağıdaki değerlere sahiptir:

  • SUCCEEDED: Onaylandı.
  • INACTIVE: Envanter doğrulaması isteyebilirsiniz.
  • RUNNING: İnceleniyor
  • SUSPENDED: Envanter doğrulama işlemi çok kez (genellikle 5) başarısız oldu ve tekrar istekte bulunabilmek için beklemeniz gerekiyor.
  • ACTION_REQUIRED: Envanter doğrulaması istemeden önce ek işlemler yapmanız gerekiyor.

Omnichannel Settings API ile ilgili sorunları giderme

Bu bölümde, sık karşılaşılan sorunların nasıl giderileceği açıklanmaktadır.

Çok kanallı ayar oluşturma

  • Hem LsfType hem de RegionCode değerlerini ayarladığınızdan emin olun.
  • GHLSF seçeneğini belirlerseniz istekte boş bir InStock sağlayın.
  • Satıcı üzerinde yerel mağaza vitrini türlerini seçerseniz InStock veya Pickup alanında en az bir URI sağlayın.

Çok kanallı ayarı güncelleme

Bu kaynağın güncelleme yöntemi için aşağıdaki ek kurallar gereklidir:

  • Bölge kodunu değiştiremezsiniz.
  • LIA/FLL özelliği çalışırken veya onaylandıktan sonra güncelleme yapamazsınız.
  • Satıcı tarafından barındırılan YSM türlerinden GHLSF türüne geçerken, InStock ve Pickup daha önce yapılandırılmışsa bunları LsfType güncellemesiyle birlikte güncelleme maskesine eklemeniz gerekir.

Örneğin, daha önce MHLSF_BASIC ve Pickup için başvuruda bulunduysanız ve başvurularınız reddedildiyse aşağıdaki gibi bir istek göndererek GHLSF'ye geçebilirsiniz:

PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}?update_mask=lsf_type,in_stock,pickup

{
  "lsfType": "GHLSF",
  "inStock": {},
}

Aşağıdakini değiştirin:

  • {ACCOUNT_ID}: Merchant Center hesabınızın benzersiz tanımlayıcısı
  • {REGION_CODE}: CLDR'de tanımlandığı şekilde bir bölge kodu

Envanter doğrulaması isteme

Ürün veya envanter feed'lerini güncelleyip iletişim kişisini onaylamanıza rağmen InventoryVerification.state, INACTIVE değilse:

  • Almanya, Avusturya ve İsviçre'deki satıcılar için: Hakkında sayfası incelemesini tamamladığınızdan emin olun.
  • Yaklaşık 48 saatlik bir gecikme olacaktır.
  • Envanter kontrolü başarısızlıklarının tekrarlanması durumunda (beşten fazla), hizmet, başka bir isteğe izin vermeden önce otuz günlük bir bekleme süresi uygular. Daha erken talep etmek istiyorsanız Google Destek Ekibi ile iletişime geçin.

Daha fazla bilgi

Daha fazla bilgi için Yerel envanter reklamları ve ücretsiz yerel listelemeler Yardım Merkezi'ne bakın.