আপনার স্থানীয় ইনভেনটরি বিজ্ঞাপন (LIA) ও ফ্রি স্থানীয় তালিকা (FLL) প্রোগ্রাম কনফিগার করার জন্য Omnichannel Settings API হল এন্ট্রি পয়েন্ট।
প্রোগ্রামাটিক উপায়ে এটি ব্যবহার করতে
- ওমনিচ্যানেল সেটিংস ম্যানেজ করা (তৈরি ও আপডেট করা)
- ওমনিচ্যানেল সেটিংস ফেচ (পাওয়া এবং তালিকাভুক্ত করা)
- উপযুক্ত মার্চেন্টদের জন্য ইনভেনটরি যাচাইকরণের অনুরোধ করা
আরও তথ্যের জন্য, স্থানীয় ইনভেনটরি বিজ্ঞাপন ও ফ্রি স্থানীয় তালিকা ওভারভিউ দেখুন।
পূর্বশর্ত
আপনার
একটি Merchant Center অ্যাকাউন্ট
একটি Business Profile. আপনার অ্যাকাউন্ট না থাকলে, একটি তৈরি করতে পারবেন। Business Profile-এর জন্য সাইন-আপ করুন।
আপনার Business Profile ও Merchant Center অ্যাকাউন্টের মধ্যে লিঙ্ক। লিঙ্ক তৈরি করতে, আপনি Merchant Center ব্যবহারকারী ইন্টারফেস বা Merchant API ব্যবহার করতে পারেন (Google Business Profile লিঙ্ক করুন দেখুন)।
ওমনিচ্যানেল সেটিং তৈরি করা
আপনি omnichannelSettings.create পদ্ধতি ব্যবহার করে একটি ওমনিচ্যানেল
সেটিং তৈরি করতে পারবেন। create পদ্ধতিতে ইনপুট হিসেবে omnichannelSetting রিসোর্স নেওয়া হয় এবং
সফল হলে তৈরি করা ওমনিচ্যানেল সেটিং রিটার্ন করা হয়।
তৈরি করার সময়, আপনাকে অবশ্যই regionCode ও
LsfType দুটিই পূরণ করতে হবে:
- প্রতিটি দেশের জন্য আলাদা আলাদা OmnichannelSetting থাকে।
RegionCode-এ টার্গেট করা দেশ উল্লেখ করা আছে। তৈরি করার পরে, আপনি এটি পরিবর্তন করতে পারবেন না।RegionCodeshould follow the naming rule defined by the Common Locale Data Repository (CLDR) project. - আপনার প্রোডাক্ট পৃষ্ঠার ভিত্তিতে
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}: প্রদত্ত পর্যালোচনার জন্য ব্যবহৃত একটি সঠিক URI. অননুমোদিত URI অনুমোদন আটকায়।
অনুরোধটি সফলভাবে রান করার পরে, আপনাকে নিম্নলিখিত উত্তরটি দেখানো হবে:
{
"name": "accounts/{ACCOUNT_ID}/omnichannelSettings/{omnichannel_setting}",
"regionCode": "{REGION_CODE}",
"lsfType: "MHLSF_BASIC",
"inStock": {
"uri": "{URI}",
"state": "RUNNING"
}
}
omnichannelSetting ফিল্ড ব্যবহার করে আলাদা LIA/FLL ফিচার এনরোল করলে
ম্যানুয়াল পর্যালোচনা ট্রিগার হয়, যার জন্য সাধারণত কয়েক ঘণ্টা থেকে কয়েক দিন সময় লাগে। আমরা
সঠিক ডেটা না থাকার কারণে অপেক্ষা করার সময় যাতে নষ্ট না হয়, সেই জন্য আপনার ইনপুট
ডবল-চেক করে নেওয়ার পরামর্শ দিই।
আপনার নতুন তৈরি করা ওমনিচ্যানেল সেটিং দেখতে অথবা পর্যালোচনার স্ট্যাটাস চেক করতে,
দেশ উল্লেখ করে accounts.omnichannelSettings.get অথবা accounts.omnichannelSettings.list
ব্যবহার করুন।
স্থানীয় স্টোর ফ্রন্ট (LSF)-এর ধরন
আপনি যে প্রোডাক্ট পৃষ্ঠা ব্যবহার করার পরিকল্পনা করেছেন তার উপর ভিত্তি করে, একটি LsfType বেছে নিন:
| প্রোডাক্ট পৃষ্ঠার ধরন | LsfType | Enum ভ্যালু |
|---|---|---|
| স্টোর-মধ্যস্থ প্রোডাক্টের উপলভ্যতার তথ্য সহ প্রোডাক্ট পৃষ্ঠা | মার্চেন্ট-হোস্টেড লোকাল স্টোর ফ্রন্ট বেসিক | MHLSF_BASIC |
| উপলভ্যতা এবং দাম সহ স্টোর-নির্দিষ্ট প্রোডাক্টের পৃষ্ঠা | মার্চেন্ট-হোস্টেড লোকাল স্টোর ফ্রন্ট সম্পূর্ণ | MHLSF_FULL |
| স্টোর-মধ্যস্থ প্রোডাক্টের উপলভ্যতার তথ্য ছাড়াই প্রোডাক্টের পৃষ্ঠা | Google-হোস্ট করা স্থানীয় স্টোর ফ্রন্ট (GHLSF) | GHLSF |
আপনি মার্চেন্ট-হোস্ট করা স্থানীয় স্টোর ফ্রন্ট ধরন বেছে নিলে, আপনাকে অন্তত একটি inStock বা pickup-এর জন্য
URI ফিল্ডও পূরণ করতে হবে।
InStock
আপনার প্রোডাক্ট পৃষ্ঠা সম্পর্কে আরও তথ্য প্রদান করতে, আপনি InStock ব্যবহার করতে পারেন।
আপনি Merchant-Hosted LSF ধরন বেছে নিলে এবং InStock-এ URI ফিল্ড নির্দিষ্ট করলে, স্টকে উপলভ্য প্রোডাক্ট পরিবেশন করার উদ্দেশ্য আপনি প্রকাশ করছেন। প্রদত্ত URI-এর ভিত্তিতে আমরা পর্যালোচনা শুরু করব।
আপনি GHLSF ধরন বেছে নিলে, আপনাকে অনুরোধে
একটি ফাঁকা InStock ফিল্ড দিতে হবে। মার্চেন্ট-হোস্টেড LSF ধরনের ক্ষেত্রে অনবোর্ডিং সম্পূর্ণ করতে, আপনাকে
ইনভেনটরি যাচাইকরণ প্রসেস সম্পূর্ণ করতে হবে।
এই কোড স্যাম্পেল 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)
পিক-আপ
স্টোরে উপলভ্যতার পাশাপাশি, আপনি পিক-আপ ফিচারের মাধ্যমেও স্টোরে উপলভ্য প্রোডাক্টের তথ্য উন্নত করতে পারবেন, যা শুধুমাত্র মার্চেন্ট-হোস্টেড LSF ধরনের জন্য উপযুক্ত।
কোনও প্রোডাক্ট 'পিক-আপ' হিসেবে চিহ্নিত করা হলে, এর অর্থ হল যে গ্রাহক এটি অনলাইনে কিনতে
পারবেন এবং স্টোর থেকে পিক-আপ করতে পারবেন। Pickup ফিল্ড সেট করার মাধ্যমে, আপনি পিক-আপ SLA সহ প্রোডাক্ট পরিবেশন করার
ইচ্ছা প্রকাশ করছেন। আপনার দেওয়া URI-এর ভিত্তিতে আমরা পর্যালোচনা শুরু করব।
Pickup সহ omnichannel সেটিং তৈরি করার জন্য এখানে একটি অনুরোধের নমুনা দেওয়া হল:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings
{
"regionCode": "{REGION_CODE}",
"lsfType: "MHLSF_BASIC",
"pickup": {
"uri: "{URI}"
}
}
অর্ডার করার জন্য দেখানো হচ্ছে
অর্ডার দেওয়ার জন্য ডিসপ্লেতে আছে ফিচারের সাহায্যে, আপনি এমন প্রোডাক্ট দেখাতে পারবেন যা আপনার ফিজিক্যাল স্টোরে দেখানো হয়, কিন্তু তৎক্ষণাৎ কেনার জন্য উপলভ্য নয়। যেমন, বড় আসবাবপত্র:
- Google-এ একই ধরনের প্রোডাক্ট খুঁজছেন এমন গ্রাহকরা তাদের সার্চ ফলাফলে "ইন-স্টোর" অ্যানোটেশন সহ এইসব বিজ্ঞাপন দেখতে পাবেন।
- Google Search ফলাফল পৃষ্ঠায় স্টোর ব্রাউজ করা গ্রাহকরা এইসব প্রোডাক্ট "অর্ডার করার জন্য উপলভ্য" হিসেবে চিহ্নিত করা হয়েছে বলে দেখতে পাবেন।
আইটেমটি দেখার জন্য তারা আপনার স্থানীয় ইনভেনটরি বিজ্ঞাপন বা ফ্রি স্থানীয় তালিকা বেছে নিতে পারেন। আইটেমটি কিনতে, তারা আপনার ফিজিক্যাল স্টোরে যেতে, আইটেমটি দেখতে এবং তারপরে সেটি তাদের কাছে শিপিং করার জন্য অর্ডার করতে পারে অথবা আপনার স্টোরে পিক-আপ করার জন্য শিপিং করতে পারে।
সম্পর্কে (জার্মানি, অস্ট্রিয়া ও সুইজারল্যান্ড)
আপনি যদি অস্ট্রিয়া ও জার্মানিতে পরিষেবা প্রদান করেন এবং GHLSF বিকল্প বেছে নেন, তাহলে আপনাকে অবশ্যই একটি
সম্পর্কে
পৃষ্ঠা জমা দিতে হবে।
আপনি সুইজারল্যান্ডে বিজ্ঞাপন দেখালে, আপনাকে অবশ্যই একটি "সম্পর্কে" পৃষ্ঠা জমা দিতে হবে, তা সে যে ধরনেরই হোক না কেন
LsfType।
'এই সম্পর্কে' পৃষ্ঠার URL যাচাই না হওয়া পর্যন্ত, 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 ফিল্ডে আপনার স্থানীয় ফিড পার্টনারশিপের স্ট্যাটাস দেখা যায়। পার্টনারশিপের সাথে লিঙ্ক করতে, 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 ফিল্ডে
সংশ্লিষ্ট ফিল্ড পূরণ করতে হবে।
আপনি
lsfTypeinStockpickupodoaboutinventoryVerification
আপডেট মাস্কে কোনও অ্যাট্রিবিউট অন্তর্ভুক্ত না থাকলে, সেটি আপডেট করা হবে না।
আপডেট মাস্কে কোনও অ্যাট্রিবিউট অন্তর্ভুক্ত করা হলে, কিন্তু অনুরোধে সেটি সেট করা না থাকলে, সেটি পরিষ্কার করা হবে।
নিচের কোড স্যাম্পেল থেকে কীভাবে ইনভেনটরি যাচাইকরণ ফিল্ড আপডেট করতে হয় তা জানতে পারবেন।
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
মার্চেন্টদের জন্য প্রাসঙ্গিক।
এই RPC কল করার আগে, আপনাকে নিম্নলিখিত কাজগুলি করতে হবে:
- আপনার প্রোডাক্ট ও ইনভেনটরি ডেটা আপলোড করুন।
- ইনভেনটরি যাচাইকরণের পরিচিতি যাচাই করুন।
- অস্ট্রিয়া, জার্মানি বা সুইজারল্যান্ডের মার্চেন্টদের জন্য, একটি
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
omnichannelSetting-এর সংশ্লিষ্ট অ্যাট্রিবিউট চেক করুন যা
omnichannelSettings.get বা omnichannelSettings.list পদ্ধতি দ্বারা ফেরত দেওয়া হয়েছে।
ReviewState ফিল্ডটি ইনভেন্টরি যাচাইকরণ প্রসেস
ছাড়া অনবোর্ডিং সংক্রান্ত সব পর্যালোচনার ক্ষেত্রে প্রযোজ্য এবং এর নিম্নলিখিত ভ্যালু থাকতে পারে:
ACTIVE: এটি অনুমোদিত।FAILED: এটি বাতিল করা হয়েছে।RUNNING: এটি এখনও পর্যালোচনা করা হচ্ছে।ACTION_REQUIRED: এটি শুধুমাত্র GHLSF মার্চেন্টদের জন্যInStock.state-এ উপলভ্য। এর অর্থ হল, LIA পরিবেশন করার জন্য আপনাকে ইনভেনটরি যাচাইকরণের অনুরোধ করতে হবে।
InventoryVerification.State-এর নিম্নলিখিত মান আছে:
SUCCEEDED: এটি অনুমোদিত।INACTIVE: আপনি ইনভেনটরি যাচাইকরণের অনুরোধ করার জন্য প্রস্তুত।RUNNING: এটি পর্যালোচনা করা হচ্ছেSUSPENDED: আপনি অনেকবার (সাধারণত ৫ বারের বেশি) ইনভেনটরি যাচাইকরণে ব্যর্থ হয়েছেন এবং আবার অনুরোধ করার আগে আপনাকে অপেক্ষা করতে হবে।ACTION_REQUIRED: ইনভেনটরি যাচাইকরণের অনুরোধ করার আগে আপনাকে অতিরিক্ত অ্যাকশন নিতে হবে।
Omnichannel Settings API সম্পর্কিত সমস্যার সমাধান করা
এই বিভাগে সাধারণ সমস্যার সমাধান কীভাবে করতে হয় তা বর্ণনা করা হয়েছে।
ওমনিচ্যানেল সেটিং তৈরি করা
LsfTypeওRegionCode, দু'টিই সেট করতে ভুলবেন না।- আপনি
GHLSFবেছে নিলে, অনুরোধে একটি ফাঁকাInStockদিন। - আপনি মার্চেন্ট-হোস্টেড LSF ধরন বেছে নিলে,
InStockবাPickup-এ অন্তত একটি URI দিন।
ওমনিচ্যানেল সেটিং আপডেট করা
এই রিসোর্সের আপডেট পদ্ধতির জন্য নিম্নলিখিত অতিরিক্ত নিয়ম মেনে চলতে হবে:
- আপনি অঞ্চলের কোড পরিবর্তন করতে পারবেন না।
- LIA/FLL ফিচার চালু বা অনুমোদিত হলে আপনি আপডেট করতে পারবেন না।
- মার্চেন্ট-হোস্টেড LSF ধরন থেকে
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-এর থেকে আলাদা হলে:
- অস্ট্রিয়া, জার্মানি ও সুইজারল্যান্ডের মার্চেন্টদের জন্য: আপনি সম্পর্কে পৃষ্ঠা পর্যালোচনা সম্পূর্ণ করেছেন কিনা তা নিশ্চিত করুন।
- প্রায় ৪৮ ঘণ্টা দেরি হবে।
- বারবার ইনভেনটরি চেক ব্যর্থ হলে (পাঁচের বেশি বার), অন্য অনুরোধ করার অনুমতি দেওয়ার আগে পরিষেবা ত্রিশ দিনের কুলিং-ডাউন পিরিয়ড প্রয়োগ করে। আপনি যদি এর আগেই অনুরোধ করতে চান, তাহলে Google সহায়তা টিমের সাথে যোগাযোগ করুন।
আরও জানুন
আরও তথ্যের জন্য, স্থানীয় ইনভেনটরি বিজ্ঞাপন ও ফ্রি স্থানীয় তালিকা সহায়তা কেন্দ্র দেখুন।