OmnichannelSettings API は、ローカル在庫広告(LIA)と無料ローカル リスティング(FLL)プログラムの設定のエントリ ポイントです。
プログラムから以下の目的で使用できる
- オールチャネル設定を管理する(作成、更新)
- オムニチャネル設定を取得(取得して一覧表示)する
- 対象となる販売者の在庫確認をリクエストする
詳しくは、ローカル在庫広告と無料ローカル リスティングの概要をご覧ください。
前提条件
以下の要件を満たしている必要があります。
Merchant Center アカウント
ビジネス プロフィールを作成します。アカウントがない場合は、作成できます。ビジネス プロフィールに登録するをご覧ください。
ビジネス プロフィールと Merchant Center アカウントのリンク。リンクを作成するには、Merchant Center の管理画面または Merchant API を使用します(Google ビジネス プロフィールをリンクするを参照)。
オムニチャネル設定を作成する
オムニチャネル設定を作成するには、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/v1beta/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 | 列挙値 |
---|---|---|
商品ページ(店舗の在庫状況を含む) | 販売者ホスト型店舗詳細ページ(標準版) | MHLSF_BASIC |
店舗固有の商品ページ(在庫状況と価格を含む) | 販売者ホスト型店舗詳細ページ(完全版) | MHLSF_FULL |
商品ページ(店舗の在庫状況を含まない) | Google ホスト型店舗詳細ページ(GHLSF) | GHLSF |
販売者ホスト型店舗詳細ページのタイプを選択した場合は、inStock
または pickup
のいずれか、または両方の URI フィールドも入力する必要があります。
InStock
InStock を使用すると、商品ページに関する詳細情報を提供できます。
販売者ホストの LSF タイプを選択し、InStock の URI フィールドを指定すると、在庫ありの商品を配信する意思を示します。ご提供いただいた URI に基づいて審査を開始します。
GHLSF
タイプを選択する場合は、リクエストに空の InStock
フィールドを指定する必要があります。販売者ホスト型 LSF タイプとは異なり、オンボーディングを完了するには、在庫確認手続きを完了する必要があります。
このコードサンプルでは、GHLSF
を使用して omnichannelSetting
を作成します。
package shopping.merchant.samples.accounts.v1beta;
// [START merchantapi_create_omnichannel_setting]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.AccountName;
import com.google.shopping.merchant.accounts.v1beta.CreateOmnichannelSettingRequest;
import com.google.shopping.merchant.accounts.v1beta.InStock;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSetting.LsfType;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.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 retrieved credentials.
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 occurred: ");
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);
}
}
// [END merchantapi_list_omnichannel_settings]
受け取り
店舗の在庫状況に加えて、店舗受け取り機能を使用して店舗内商品を強化することもできます。この機能は、販売者のホストする LSF タイプでのみ利用できます。
商品に「店舗受け取り」とマークされている場合、お客様はオンラインで購入して店舗で受け取ることができます。Pickup
フィールドを設定すると、集荷 SLA で商品を提供する意思を示します。ご提供いただいた URI に基づいて審査を開始いたします。
Pickup
を使用して omnichannel
設定を作成するリクエストの例を次に示します。
POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/omnichannelSettings
{
"regionCode": "{REGION_CODE}",
"lsfType: "MHLSF_BASIC",
"pickup": {
"uri: "{URI}"
}
}
見本展示あり
見本展示あり機能を使用すると、実店舗に展示されているがすぐには購入できない商品を表示できます。たとえば、大型家具などです。
- Google で類似商品を探しているユーザーには、検索結果に「店舗」のアノテーションが付いた広告が表示されます。
- Google 検索の検索結果ページでショップをブラウジングしているユーザーには、これらの商品は「注文可能」とマークされて表示されます。
ユーザーは、ローカル在庫広告または無料ローカル リスティングを選択して商品アイテムを表示できます。購入するには、実店舗に行き、商品アイテムを確認して注文します。注文した商品アイテムは、自宅に配送してもらうことも、店舗で受け取ることもできます。
概要(ドイツ、オーストリア、スイス)
オーストリアとドイツで配信し、[GHLSF
] を選択する場合は、概要ページを登録する必要があります。
スイスで配信する場合は、LsfType
に関係なく「概要」ページを送信する必要があります。
概要ページの URL が確認されるまで、GHLSF
販売者は Google に手動在庫確認をリクエストできません。
これらの 3 か国のすべての販売者の場合、概要ページが承認されるまで、FLL/LIA 機能は有効になりません。
在庫確認
在庫確認は GHLSF
販売者様にのみ必要です。MHLSF
型ではサポートされていません。
商品データと在庫データを追加する前または後(accounts.products.localInventories.insert
または Merchant Center ユーザー インターフェースのいずれかを使用)に、連絡先を確認する必要があります。create
メソッドまたは update
メソッドを使用して、在庫確認の連絡先(名前とメールアドレス)を指定します。連絡先には Google からメールが届き、メッセージ内のボタンをクリックしてステータスを確認できます。
設定が完了したら、在庫確認をリクエストできます。詳細については、インベントリの検証についてをご覧ください。
連絡先は、確認プロセス中または確認後に omnichannelSetting.update
を使用して変更できます。
このプロセスが完了すると、提供された情報の正確性が検証されます。
オムニチャネル設定を取得する
特定の国での omnichannelSetting
構成を取得したり、レビューの現在のステータスを確認したりするには、omnichannelSettings.get
メソッドを使用します。
リクエストの例を次に示します。
GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}
次のように置き換えます。
{ACCOUNT_ID}
: Merchant Center アカウントの一意の識別子{OMNICHANNEL_SETTING}
: ターゲットとする国の地域コード
ACTIVE
ステータスは、レビューが承認されたことを示します。
ステータスが FAILED
の場合は、問題に対処し、omnichannelSetting.update
を呼び出して新しい審査をトリガーします。
読み取り専用の LFP
フィールドには、ローカル フィード パートナーシップのステータスが表示されます。パートナーシップにリンクするには、lfpProviders.linkLfpProvider
を使用します。
ステータスの確認とその意味について詳しくは、オムニチャネル設定のステータスを表示するをご覧ください。
オムニチャネル設定を一覧表示する
アカウントのすべての omnichannelSetting
情報を取得するには、omnichannelSettings.list
メソッドを使用します。
コードサンプルは次のとおりです。
package shopping.merchant.samples.accounts.v1beta;
// [START merchantapi_list_omnichannel_settings]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.AccountName;
import com.google.shopping.merchant.accounts.v1beta.ListOmnichannelSettingsRequest;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceClient.ListOmnichannelSettingsPagedResponse;
import com.google.shopping.merchant.accounts.v1beta.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 retrieved credentials.
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 occurred: ");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
omnichannelSettings(config);
}
}
// [END merchantapi_list_omnichannel_settings]
オムニチャネルの設定を更新する
既存のオムニチャネル設定の構成を更新するには、omnichannelSettings.update
メソッドを使用します。
更新するには、更新マスクに必要な対象物を追加し、更新リクエストの omnichannelSetting
フィールドに対応するフィールドを入力する必要があります。次のいずれかを更新できます。
lsfType
inStock
pickup
odo
about
inventoryVerification
更新マスクに属性が含まれていない場合、その属性は更新されません。
更新マスクに含まれる属性がリクエストで設定されていない場合、その属性はクリアされます。
次のコードサンプルは、在庫確認フィールドを更新する方法を示しています。
package shopping.merchant.samples.accounts.v1beta;
// [START merchantapi_update_omnichannel_setting]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.protobuf.FieldMask;
import com.google.shopping.merchant.accounts.v1beta.InventoryVerification;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1beta.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 retrieved credentials.
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 occurred: ");
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);
}
}
// [END merchantapi_update_omnichannel_setting]
在庫確認をリクエストする
omnichannelSettings.requestInventoryVerification
は GHLSF
販売者にのみ関連します。
この RPC を呼び出す前に、次の操作を行う必要があります。
- 商品データと在庫データをアップロードします。
- 在庫確認用の連絡先を確認します。
- オーストリア、ドイツ、スイスの販売者は、
About
ページの確認を完了します。
対象かどうかを判断するには、omnichannelSettings.get
を呼び出して omnichannelSetting.inventoryVerification.state
を確認します。INACTIVE
が表示されたら、omnichannelSettings.requestInventoryVerification
を呼び出すことができます。
package shopping.merchant.samples.accounts.v1beta;
// [START merchantapi_request_inventory_verification]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1beta.RequestInventoryVerificationRequest;
import com.google.shopping.merchant.accounts.v1beta.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 retrieved credentials.
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 occurred: ");
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);
}
}
// [END merchantapi_request_inventory_verification]
オールチャネル設定のステータスを確認する。
LIA オンボーディングの審査のステータスを確認するには、omnichannelSettings.get
メソッドまたは omnichannelSettings.list
メソッドから返された omnichannelSetting
の対応する属性を ReviewState
で確認します。
ReviewState
フィールドは、在庫確認プロセスを除くすべてのオンボーディング審査に適用され、次の値を指定できます。
ACTIVE
: 承認済みです。FAILED
: 拒否されます。RUNNING
: まだ審査中です。ACTION_REQUIRED
: GHLSF 販売者のInStock.state
にのみ存在します。つまり、LIA を配信するには、在庫確認をリクエストする必要があります。
InventoryVerification.State
の値は次のとおりです。
SUCCEEDED
: 承認済みです。INACTIVE
: 在庫確認をリクエストする準備が整いました。RUNNING
: 審査中SUSPENDED
: 在庫確認が不承認になった回数が多すぎる(通常 5 回)ため、再リクエストできるようになるまで待つ必要があります。ACTION_REQUIRED
: 在庫確認をリクエストする前に、追加の操作を行う必要があります。
OmnichannelSettings
API に関連する問題のトラブルシューティング
このセクションでは、一般的な問題のトラブルシューティング方法について説明します。
オムニチャネル設定を作成する
LsfType
とRegionCode
の両方を設定してください。GHLSF
を選択した場合は、リクエストに空のInStock
を指定します。- 販売者ホスト型 LSF タイプを選択する場合は、
InStock
またはPickup
に URI を 1 つ以上指定します。
オムニチャネルの設定を更新する
このリソースの更新方法には、次の追加ルールが必要です。
- 地域コードは変更できません。
- LIA/FLL 機能が実行中または承認されている間は、更新できません。
- 販売者ホスト型 LSF タイプから
GHLSF
に変更する場合、以前にInStock
とPickup
が構成されている場合は、LsfType
の更新とともに更新マスクに含める必要があります。
たとえば、以前に MHLSF_BASIC
と Pickup
を適用して拒否された場合は、次のようなリクエストを送信して GHLSF
に切り替えることができます。
PATCH https://merchantapi.googleapis.com/accounts/v1beta/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 時間ほど遅延が発生します。
- 在庫チェックが繰り返し失敗した場合(5 回以上)、サービスは 30 日間のクールダウン期間を適用してから、別のリクエストを許可します。早期の払い戻しをご希望の場合は、Google サポートにお問い合わせください。
その他の情報
詳しくは、ローカル在庫広告と無料ローカル リスティングのヘルプセンターをご覧ください。