ओमनीचैनल की सेटिंग मैनेज करना

Omnichannel Settings API, Local Inventory Ads (LIA) और Free Local Listings (FLL) प्रोग्राम को कॉन्फ़िगर करने का एंट्री पॉइंट है.

इसका इस्तेमाल प्रोग्राम के हिसाब से इन कामों के लिए करें

  • ओम्नीचैनल की सेटिंग मैनेज करना (बनाना और अपडेट करना)
  • Omnichannel की सेटिंग फ़ेच करना (पाना और सूची बनाना)
  • ज़रूरी शर्तें पूरी करने वाले कारोबारियों या कंपनियों के लिए, इन्वेंट्री की पुष्टि का अनुरोध करना

ज़्यादा जानकारी के लिए, स्थानीय इन्वेंट्री विज्ञापनों और मुफ़्त में दिखाई जाने वाली स्थानीय लिस्टिंग की खास जानकारी देखें.

ज़रूरी शर्तें

आपके पास ये होने चाहिए

  • Merchant Center खाता

  • Business Profile. अगर आपके पास Google खाता नहीं है, तो खाता बनाया जा सकता है. Business Profile के लिए साइन अप करना लेख पढ़ें.

  • आपकी Business Profile और Merchant Center खाते के बीच लिंक. लिंक बनाने के लिए, Merchant Center के उपयोगकर्ता इंटरफ़ेस या Merchant API का इस्तेमाल किया जा सकता है. इसके बारे में जानने के लिए, Google Business Profile को लिंक करना लेख पढ़ें.

कई तरीकों से खरीदारी की सुविधा की सेटिंग बनाना

ओमनीचैनल सेटिंग बनाने के लिए, omnichannelSettings.create तरीके का इस्तेमाल किया जा सकता है. create तरीके में, omnichannelSetting संसाधन को इनपुट के तौर पर लिया जाता है. अगर यह तरीका काम करता है, तो यह बनाई गई ओम्नीचैनल सेटिंग दिखाता है.

इसे बनाते समय, आपको regionCode और LsfType, दोनों फ़ील्ड भरने होंगे:

  • OmnichannelSetting, हर देश के हिसाब से तय होती है. RegionCode से टारगेट किए गए देश का पता चलता है. इसे बनाने के बाद, बदला नहीं जा सकता. RegionCode को Common Locale Data Repository (CLDR) प्रोजेक्ट में तय किए गए नाम के नियम का पालन करना चाहिए.
  • LsfType, आपके प्रॉडक्ट पेज के हिसाब से काम करता है. ज़्यादा जानकारी के लिए, LsfType देखें.

ज़्यादा जानकारी के लिए, स्थानीय इन्वेंट्री विज्ञापनों के लिए, प्रॉडक्ट पेज के अनुभव में बदलाव करना लेख पढ़ें.

आपको कैंपेन बनाते समय सभी फ़ील्ड भरने की ज़रूरत नहीं है. हालांकि, इन्हें बाद में कॉन्फ़िगर किया जा सकता है. मौजूदा omnichannelSetting को अपडेट करने के लिए, ओमनीचैनल सेटिंग अपडेट करना लेख पढ़ें.

MHLSF_BASIC को चुनने और inStock में रजिस्टर करने के लिए, अनुरोध का एक सैंपल यहां दिया गया है:

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

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

इनकी जगह ये डालें:

  • {ACCOUNT_ID}: आपके Merchant Center खाते का यूनीक आइडेंटिफ़ायर
  • {REGION_CODE}: CLDR के हिसाब से रीजन कोड
  • {URI}: यह समीक्षा के लिए इस्तेमाल किया गया मान्य यूआरआई है. ज़रूरी शर्तें पूरी न करने वाले यूआरआई की वजह से, मंज़ूरी नहीं मिल सकती.

अनुरोध पूरा होने के बाद, आपको यह जवाब दिखेगा:

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

omnichannelSetting फ़ील्ड का इस्तेमाल करके, एलआईए/एफ़एलएल की अलग-अलग सुविधाओं के लिए रजिस्टर करने पर, मैन्युअल तरीके से समीक्षाएं शुरू हो जाती हैं. आम तौर पर, इनमें कुछ घंटों से लेकर कुछ दिन तक लग सकते हैं. हमारा सुझाव है कि आप अपने इनपुट की दोबारा जांच करें, ताकि अयोग्य डेटा की वजह से आपको इंतज़ार न करना पड़े.

नई ओमनीचैनल सेटिंग देखने या समीक्षाओं की स्थिति देखने के लिए, accounts.omnichannelSettings.get या accounts.omnichannelSettings.list का इस्तेमाल करें. इसके लिए, देश का नाम डालें.

लोकल स्टोरफ़्रंट (एलएसएफ़) का टाइप

आपको जिस प्रॉडक्ट पेज का इस्तेमाल करना है उसके हिसाब से, कोई LsfType चुनें:

प्रॉडक्ट पेज का टाइप LsfType इनम वैल्यू
स्टोर में प्रॉडक्ट की उपलब्धता बताने वाला पेज कारोबारी का होस्ट किया गया लोकल स्टोरफ़्रंट (बेसिक) MHLSF_BASIC
स्टोर में मौजूद खास प्रॉडक्ट के पेज जिन पर प्रॉडक्ट की खरीदारी के लिए उपलब्धता और उसकी कीमत दिखाई गई है कारोबारी का होस्ट किया गया लोकल स्टोरफ़्रंट (फ़ुल) MHLSF_FULL
प्रॉडक्ट के ऐसे पेज जिन पर स्टोर में खरीदारी के लिए उपलब्धता की जानकारी नहीं है Google का होस्ट किया गया लोकल स्टोरफ़्रंट (जीएचएलएसएफ़) GHLSF

कारोबारी के होस्ट किए गए लोकल स्टोरफ़्रंट के टाइप चुनने पर, आपको कम से कम एक inStock या pickup के लिए यूआरआई फ़ील्ड भी भरना होगा.

InStock

InStock का इस्तेमाल करके, अपने प्रॉडक्ट पेज के बारे में ज़्यादा जानकारी दी जा सकती है.

अगर आपने कारोबारी के होस्ट किए गए एलएसएफ़ टाइप चुने हैं और InStock में यूआरआई फ़ील्ड की जानकारी दी है, तो इसका मतलब है कि आपको 'स्टॉक में है' के तौर पर मार्क किए गए प्रॉडक्ट दिखाने हैं. हम दिए गए यूआरआई के आधार पर समीक्षा शुरू करेंगे.

GHLSF टाइप चुनने पर, आपको अनुरोध में एक खाली InStock फ़ील्ड देना होगा. कारोबारी के प्लैटफ़ॉर्म पर होस्ट किए गए एलएसएफ़ टाइप के उलट, शामिल होने की प्रोसेस पूरी करने के लिए, आपको इन्वेंट्री की पुष्टि करने की प्रोसेस पूरी करनी होगी.

इस कोड सैंपल से, GHLSF के साथ omnichannelSetting बनाया जाता है:

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)

पिकअप

स्टोर में प्रॉडक्ट की उपलब्धता के अलावा, स्टोर में मौजूद प्रॉडक्ट को पिकअप करने की सुविधा के साथ भी बेहतर बनाया जा सकता है. यह सुविधा सिर्फ़ कारोबारी या कंपनी के होस्ट किए गए लोकल स्टोरफ़्रंट के लिए उपलब्ध है.

किसी प्रॉडक्ट को पिकअप के लिए मार्क करने का मतलब है कि खरीदार उसे ऑनलाइन खरीद सकता है और स्टोर से पिक अप कर सकता है. Pickup फ़ील्ड सेट करने का मतलब है कि आपको पिकअप के समय की जानकारी के साथ प्रॉडक्ट दिखाने हैं. हम दिए गए यूआरआई के आधार पर समीक्षा शुरू करेंगे.

यहां एक अनुरोध का सैंपल दिया गया है, जो omnichannel सेटिंग बनाता है. इसमें Pickup शामिल है:

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

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

ऑर्डर करने के लिए डिसप्ले

ऑर्डर करने के लिए डिसप्ले सुविधा का इस्तेमाल ऐसे प्रॉडक्ट दिखाने के लिए किया जा सकता है जो आपकी दुकान में दिखाए तो जाते हैं, लेकिन तुरंत खरीदने के लिए उपलब्ध नहीं होते. उदाहरण के लिए, बड़ा फ़र्नीचर:

  • ये विज्ञापन, Google पर मिलते-जुलते प्रॉडक्ट खोजने वाले खरीदारों को खोज के नतीजों में "स्टोर में जाकर" एनोटेशन के साथ दिखेंगे.
  • ये प्रॉडक्ट, Google पर खोज के नतीजों वाले पेज में स्टोर ब्राउज़ करने वाले खरीदारों को "ऑर्डर करने के लिए उपलब्ध" लेबल से साथ दिखेंगे.

सामान देखने के लिए, वे आपके स्थानीय इन्वेंट्री विज्ञापन या मुफ़्त में दिखाई जाने वाली स्थानीय लिस्टिंग को चुन सकते हैं. सामान खरीदने के लिए, वे आपकी दुकान पर जाकर उसे देख सकते हैं. इसके बाद, वे सामान को अपने पते पर शिप करवाने या स्टोर से पिक अप करने के लिए ऑर्डर कर सकते हैं.

इसके बारे में जानकारी (जर्मनी, ऑस्ट्रिया, और स्विट्ज़रलैंड)

अगर आपको ऑस्ट्रिया और जर्मनी में विज्ञापन दिखाने हैं और आपने GHLSF चुना है, तो आपको इसके बारे में जानकारी वाला पेज सबमिट करना होगा.

अगर आपको स्विट्ज़रलैंड में विज्ञापन दिखाने हैं, तो आपको "इसके बारे में जानकारी" पेज सबमिट करना होगा. भले ही, LsfType कुछ भी हो.

जब तक 'इसके बारे में जानकारी' पेज के यूआरएल की पुष्टि नहीं हो जाती, तब तक GHLSF कारोबारी या कंपनियां, Google से मैन्युअल तरीके से इन्वेंट्री की पुष्टि करने का अनुरोध नहीं कर सकतीं.

इन तीन देशों में मौजूद सभी कारोबारियों या कंपनियों के लिए, यह सेवा तब तक FLL/LIA सुविधाएं चालू नहीं करती, जब तक आपके 'इसके बारे में जानकारी' पेज को मंज़ूरी नहीं मिल जाती.

इन्वेंट्री की पुष्टि

इन्वेंट्री की पुष्टि सिर्फ़ GHLSF कारोबारियों या कंपनियों के लिए ज़रूरी है. यह MHLSF टाइप के लिए काम नहीं करता.

प्रॉडक्ट डेटा और इन्वेंट्री डेटा जोड़ने से पहले या बाद में, आपको अपने संपर्क की पुष्टि करनी होगी. इसके लिए, accounts.products.localInventories.insert या Merchant Center के उपयोगकर्ता इंटरफ़ेस का इस्तेमाल करें. create या update तरीके का इस्तेमाल करके, इन्वेंट्री की पुष्टि करने वाले व्यक्ति का नाम और ईमेल पता दें. Google, संपर्क व्यक्ति को एक ईमेल भेजेगा. इसमें दिए गए बटन पर क्लिक करके, वह अपने स्टेटस की पुष्टि कर पाएगा.

यह प्रोसेस पूरी होने के बाद, इन्वेंट्री की पुष्टि का अनुरोध किया जा सकता है. ज़्यादा जानकारी के लिए, इन्वेंट्री की पुष्टि करने के बारे में जानकारी लेख पढ़ें.

पुष्टि की प्रक्रिया के दौरान या इसके बाद, omnichannelSetting.update का इस्तेमाल करके संपर्क जानकारी बदली जा सकती है.

यह प्रोसेस पूरी होने के बाद, Google दी गई जानकारी की पुष्टि करता है.

कई तरीकों से खरीदारी की सुविधा की सेटिंग पाना

किसी देश में omnichannelSetting कॉन्फ़िगरेशन को वापस पाने या अपनी समीक्षाओं की मौजूदा स्थिति देखने के लिए, omnichannelSettings.get तरीके का इस्तेमाल करें.

अनुरोध का एक उदाहरण यहां दिया गया है:

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

इनकी जगह ये डालें:

  • {ACCOUNT_ID}: आपके Merchant Center खाते का यूनीक आइडेंटिफ़ायर
  • {OMNICHANNEL_SETTING}: टारगेट किए गए देश का क्षेत्र कोड

ACTIVE स्टेटस से पता चलता है कि समीक्षा को मंज़ूरी मिल गई है.

अगर स्टेटस FAILED है, तो समस्याओं को ठीक करें और omnichannelSetting.update को कॉल करके, नई समीक्षा ट्रिगर करें.

सिर्फ़ पढ़ने के लिए उपलब्ध LFP फ़ील्ड में, Local Feeds Partnership का स्टेटस दिखता है. साझेदारी से लिंक करने के लिए, lfpProviders.linkLfpProvider का इस्तेमाल करें.

स्टेटस और उनके मतलब देखने के बारे में ज़्यादा जानने के लिए, ओमनीचैनल सेटिंग का स्टेटस देखें लेख पढ़ें.

कई तरीकों से खरीदारी की सुविधा की सेटिंग की सूची बनाना

अपने खाते के लिए, सभी omnichannelSetting जानकारी वापस पाने के लिए, omnichannelSettings.list तरीके का इस्तेमाल करें.

यहां कोड का एक सैंपल दिया गया है:

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)

कई तरीकों से खरीदारी की सुविधा की सेटिंग अपडेट करना

किसी मौजूदा ओम्नीचैनल सेटिंग के कॉन्फ़िगरेशन को अपडेट करने के लिए, omnichannelSettings.update तरीके का इस्तेमाल करें.

अपडेट करने के लिए, आपको अपडेट मास्क में वह सुविधा जोड़नी होगी जिसे आपको अपडेट करना है. साथ ही, अपडेट के अनुरोध में omnichannelSetting फ़ील्ड में उससे जुड़े फ़ील्ड भरने होंगे. इनमें से किसी भी

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

अगर किसी एट्रिब्यूट को अपडेट मास्क में शामिल नहीं किया जाता है, तो उसे अपडेट नहीं किया जाएगा.

अगर कोई एट्रिब्यूट अपडेट मास्क में शामिल है, लेकिन अनुरोध में सेट नहीं किया गया है, तो उसे हटा दिया जाएगा.

यहां दिए गए कोड सैंपल में, इन्वेंट्री की पुष्टि करने वाले फ़ील्ड को अपडेट करने का तरीका बताया गया है.

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)

इन्वेंट्री की पुष्टि का अनुरोध करना

omnichannelSettings.requestInventoryVerification सिर्फ़ GHLSF कारोबारियों या कंपनियों के लिए काम का है.

इस आरपीसी को कॉल करने से पहले, आपको ये काम करने होंगे:

  • अपना प्रॉडक्ट और इन्वेंट्री डेटा अपलोड करें.
  • इन्वेंट्री की पुष्टि करने वाले व्यक्ति की पुष्टि करें.
  • ऑस्ट्रिया, जर्मनी या स्विट्ज़रलैंड में रहने वाले कारोबारियों या कंपनियों के लिए, About पेज की समीक्षा पूरी करें.

यह जानने के लिए कि आपका डिवाइस रिपेयर प्रोग्राम की ज़रूरी शर्तें पूरी करता है या नहीं, omnichannelSettings.get को कॉल करें और omnichannelSetting.inventoryVerification.state देखें. अगर आपको INACTIVE दिखता है, तो इसका मतलब है कि अब कॉल किया जा सकता है omnichannelSettings.requestInventoryVerification.

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

ओमनीचैनल सेटिंग की स्थिति देखें.

LIA में शामिल होने के लिए की गई समीक्षाओं का स्टेटस देखने के लिए, ReviewState omnichannelSettings.get या omnichannelSettings.list तरीकों से मिले omnichannelSetting के संबंधित एट्रिब्यूट देखें.

ReviewState फ़ील्ड, स्टोर सेट अप करने से जुड़ी सभी समीक्षाओं पर लागू होता है. हालांकि, यह इन्वेंट्री की पुष्टि करने की प्रोसेस पर लागू नहीं होता. इस फ़ील्ड में ये वैल्यू हो सकती हैं:

  • ACTIVE: इसे स्वीकार कर लिया गया है.
  • FAILED: इसे अस्वीकार कर दिया गया है.
  • RUNNING: इसकी समीक्षा अभी भी की जा रही है.
  • ACTION_REQUIRED: यह सिर्फ़ GHLSF में शामिल कारोबारियों या कंपनियों के लिए InStock.state में मौजूद है. इसका मतलब है कि आपको एलआईए दिखाने के लिए, इन्वेंट्री की पुष्टि का अनुरोध करना होगा.

InventoryVerification.State की ये वैल्यू हैं:

  • SUCCEEDED: इसे स्वीकार कर लिया गया है.
  • INACTIVE: अब इन्वेंट्री की पुष्टि के लिए अनुरोध किया जा सकता है.
  • RUNNING: इसकी समीक्षा की जा रही है
  • SUSPENDED: इन्वेंट्री की पुष्टि कई बार नहीं हो सकी. आम तौर पर, ऐसा पांच बार होता है. इसलिए, आपको कुछ समय इंतज़ार करना होगा. इसके बाद ही, पुष्टि के लिए फिर से अनुरोध किया जा सकेगा.
  • ACTION_REQUIRED: इन्वेंट्री की पुष्टि का अनुरोध करने से पहले, आपको कुछ और कार्रवाइयां करनी होंगी.

Omnichannel Settings API से जुड़ी समस्याएं हल करना

इस सेक्शन में, आम तौर पर होने वाली समस्याओं को हल करने का तरीका बताया गया है.

कई तरीकों से खरीदारी की सुविधा की सेटिंग बनाना

  • पक्का करें कि आपने LsfType और RegionCode, दोनों सेट किए हों.
  • अगर आपने GHLSF चुना है, तो अनुरोध में InStock की वैल्यू खाली छोड़ दें.
  • अगर आपने कारोबारी या कंपनी के होस्ट किए गए एलएसएफ़ टाइप चुने हैं, तो InStock या Pickup में कम से कम एक यूआरआई दें.

कई तरीकों से खरीदारी की सुविधा की सेटिंग अपडेट करना

इस संसाधन को अपडेट करने के लिए, इन अतिरिक्त नियमों का पालन करना ज़रूरी है:

  • इलाके के कोड में बदलाव नहीं किया जा सकता.
  • एलआईए/एफ़एलएल की सुविधा चालू होने या इसे मंज़ूरी मिलने के दौरान, अपडेट नहीं किए जा सकते.
  • मर्चेंट के होस्ट किए गए एलएसएफ़ टाइप से GHLSF पर स्विच करते समय, अगर InStock और Pickup को पहले कॉन्फ़िगर किया गया था, तो आपको उन्हें अपडेट मास्क में शामिल करना होगा. साथ ही, LsfType को भी अपडेट करना होगा.

उदाहरण के लिए, अगर आपने पहले MHLSF_BASIC और Pickup के लिए आवेदन किया था और उन्हें अस्वीकार कर दिया गया था, तो इस तरह का अनुरोध भेजकर GHLSF पर स्विच किया जा सकता है:

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

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

इनकी जगह ये डालें:

  • {ACCOUNT_ID}: आपके Merchant Center खाते का यूनीक आइडेंटिफ़ायर
  • {REGION_CODE}: CLDR के हिसाब से तय किया गया रीजन कोड

इन्वेंट्री की पुष्टि का अनुरोध करना

अगर प्रॉडक्ट या इन्वेंट्री फ़ीड अपडेट करने और संपर्क की पुष्टि करने के बावजूद, InventoryVerification.state की वैल्यू INACTIVE के अलावा कोई और वैल्यू है, तो:

  • ऑस्ट्रिया, जर्मनी, और स्विट्ज़रलैंड में रहने वाले कारोबारियों या कंपनियों के लिए: पक्का करें कि आपने 'इसके बारे में जानकारी' पेज की समीक्षा पूरी कर ली हो.
  • इसमें करीब 48 घंटे की देरी होगी.
  • अगर इन्वेंट्री की जांच पांच से ज़्यादा बार फ़ेल होती है, तो सेवा अगले अनुरोध की अनुमति देने से पहले, तीस दिनों का कूलिंग-डाउन पीरियड लागू करती है. अगर आपको तय समय से पहले रिफ़ंड पाने के लिए अनुरोध करना है, तो Google की सहायता टीम से संपर्क करें.

ज़्यादा जानें

ज़्यादा जानकारी के लिए, स्थानीय इन्वेंट्री विज्ञापन और मुफ़्त में दिखाई जाने वाली स्थानीय लिस्टिंग का सहायता केंद्र देखें.