옴니채널 설정 API는 오프라인 판매점 인벤토리 광고 (LIA) 및 무료 오프라인 등록정보 (FLL) 프로그램을 구성하는 진입점입니다.
이 API를 사용하여 프로그래매틱 방식으로 다음 작업을 할 수 있습니다.
- 옴니채널 설정 관리 (만들기 및 업데이트)
- 옴니채널 설정 가져오기 (가져오기 및 나열)
- 자격 요건을 충족하는 판매자의 인벤토리 확인 요청
자세한 내용은 오프라인 판매점 인벤토리 광고 및 무료 오프라인 등록정보 개요를 참고하세요.
기본 요건
다음이 있어야 합니다.
판매자 센터 계정
비즈니스 프로필과 판매자 센터 계정 간의 연결 연결을 만들려면 판매자 센터 사용자 인터페이스 또는 Merchant API를 사용하면 됩니다 (Google 비즈니스 프로필 연결 참고).
옴니채널 설정 만들기
omnichannelSettings.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}: 판매자 센터 계정의 고유 식별자{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을 사용하여 제품 페이지에 대한 자세한 정보를 제공할 수 있습니다.
판매자가 호스팅하는 LSF 유형을 선택하고 InStock에서 URI 필드를 지정하면 재고 정보가 있는 제품을 게재하려는 의도를 나타내는 것입니다. 제공된 URI를 기반으로 검토가 시작됩니다.
GHLSF 유형을 선택하는 경우 요청에 빈 InStock 필드를 제공해야 합니다. 판매자가 호스팅하는 LSF 유형과 달리 온보딩을 완료하려면
인벤토리 확인 절차를 완료해야 합니다.
이 코드 샘플은 GHLSF로 omnichannelSetting을 만듭니다.
자바
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 검색 결과 페이지에서 매장을 둘러보는 고객에게는 '주문 가능'이라고 표시된 제품이 보입니다.
고객은 오프라인 판매점 인벤토리 광고 또는 무료 오프라인 등록정보를 선택하여 상품을 볼 수 있습니다. 상품을 구매하려면 오프라인 상점을 방문하여 상품을 본 후 배송받거나 매장에서 수령할 수 있도록 주문하면 됩니다.
정보 (독일, 오스트리아, 스위스)
오스트리아와 독일에서 서비스를 제공하고 GHLSF를 선택하는 경우
정보
페이지를 제출해야 합니다.
스위스에서 서비스를 제공하는 경우 LsfType과 관계없이 '정보' 페이지를 제출해야 합니다.
정보 페이지 URL이 인증될 때까지 GHLSF 판매자는 Google에 수동 인벤토리 확인을 요청할 수 없습니다.
이 세 국가의 모든 판매자의 경우 정보 페이지가 승인될 때까지 서비스에서 FLL/LIA 기능을 사용 설정하지 않습니다.
인벤토리 확인
인벤토리 확인은 GHLSF 판매자에게만 필요합니다. MHLSF 유형은 지원되지 않습니다.
제품 데이터 및 인벤토리 데이터를 추가하기 전이나 후에 (accounts.products.localInventories.insert 또는 판매자 센터 사용자 인터페이스 사용) 연락처를 확인해야 합니다. create 또는 update 메서드를 사용하여 인벤토리 확인 연락처 (이름 및 이메일 주소)를 제공합니다. 연락처는 Google에서 보낸 이메일을 받게 되며 메시지의 버튼을 클릭하여 상태를 확인할 수 있습니다.
이 단계를 완료하면 인벤토리 확인을 요청할 수 있습니다. 자세한 내용은 인벤토리 확인 정보를 참고하세요.
확인 절차 중 또는 확인 후 omnichannelSetting.update를 사용하여 연락처를 변경할 수 있습니다.
이 절차가 완료되면 Google에서 제공된 정보의 정확성을 검증합니다.
옴니채널 설정 가져오기
특정 국가에서 omnichannelSetting 구성을 가져오거나 검토의 현재 상태를 확인하려면 omnichannelSettings.get 메서드를 사용하세요.
요청 샘플은 다음과 같습니다.
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}
다음을 바꿉니다.
{ACCOUNT_ID}: 판매자 센터 계정의 고유 식별자{OMNICHANNEL_SETTING}: 타겟 국가의 지역 코드
ACTIVE 상태는 검토가 승인되었음을 나타냅니다.
상태가 FAILED이면 문제를 해결하고 omnichannelSetting.update를 호출하여 새 검토를 트리거합니다.
읽기 전용 LFP 필드에는 오프라인 피드 파트너십 상태가 표시됩니다. 파트너십에 연결하려면 lfpProviders.linkLfpProvider를 사용하세요.
상태 및 의미 확인에 관한 자세한 내용은 옴니채널 설정 상태 보기를 참고하세요.
옴니채널 설정 나열
계정의 모든 omnichannelSetting 정보를 가져오려면
omnichannelSettings.list 메서드를 사용하세요.
코드 샘플은 다음과 같습니다.
자바
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
업데이트 마스크에 속성이 포함되지 않으면 업데이트되지 않습니다.
업데이트 마스크에 속성이 포함되어 있지만 요청에 설정되지 않은 경우 삭제됩니다.
다음 코드 샘플은 인벤토리 확인 필드를 업데이트하는 방법을 보여줍니다.
자바
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을 호출할 준비가 된 것입니다.
자바
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에만 존재합니다. LIA를 게재하려면 인벤토리 확인을 요청해야 합니다.
InventoryVerification.State에는 다음 값이 있습니다.
SUCCEEDED: 승인되었습니다.INACTIVE: 인벤토리 확인을 요청할 준비가 되었습니다.RUNNING: 검토 중입니다.SUSPENDED: 인벤토리 확인에 너무 많이 실패하여 (일반적으로 5회) 다시 요청하기 전에 기다려야 합니다.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}: 판매자 센터 계정의 고유 식별자{REGION_CODE}: CLDR에서 정의한 지역 코드
인벤토리 확인 요청
제품 또는 인벤토리 피드를 업데이트하고 연락처를 확인했음에도 불구하고 InventoryVerification.state가 INACTIVE가 아닌 경우 다음을 실행합니다.
- 오스트리아, 독일, 스위스의 판매자: 정보 페이지 검토를 완료했는지 확인합니다.
- 약 48시간의 지연이 발생합니다.
- 인벤토리 확인이 반복적으로 실패하는 경우 (5회 이상) 서비스에서 다른 요청을 허용하기 전에 30일의 대기 기간을 적용합니다. 더 일찍 요청하려면 Google 지원팀에 문의하세요.
자세히 알아보기
자세한 내용은 오프라인 판매점 인벤토리 광고 및 무료 오프라인 등록정보 고객센터를 참고하세요.