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/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 | 列挙値 |
|---|---|---|
| 商品ページ(店舗の在庫状況を含む) | 販売者ホスト型店舗詳細ページ(標準版) | MHLSF_BASIC |
| 店舗固有の商品ページ(在庫状況と価格を含む) | 販売者ホスト型店舗詳細ページ(完全版) | MHLSF_FULL |
| 商品ページ(店舗の在庫状況を含まない) | Google ホスト型店舗詳細ページ(GHLSF) | GHLSF |
販売者ホスト型店舗詳細ページの種類を選択した場合は、inStock または pickup のいずれか 1 つ以上の URI フィールドも入力する必要があります。
InStock
InStock を使用すると、商品ページに関する詳細情報を提供できます。
Merchant-Hosted LSF タイプを選択し、InStock で URI フィールドを指定すると、在庫ありの商品を販売する意向を示すことになります。指定された URI に基づいて審査を開始します。
GHLSF タイプを選択した場合は、リクエストで空の InStock フィールドを指定する必要があります。販売者ホスト型の LSF タイプとは異なり、オンボーディングを完了するには、在庫確認の手続きを完了する必要があります。
このコードサンプルは、GHLSF を使用して omnichannelSetting を作成します。
package shopping.merchant.samples.accounts.v1;
// [START merchantapi_create_omnichannel_setting]
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 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/v1/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 を使用して変更できます。
このプロセスが完了すると、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 メソッドを使用します。
コードサンプルは次のとおりです。
package shopping.merchant.samples.accounts.v1;
// [START merchantapi_list_omnichannel_settings]
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 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 フィールドで対応するフィールドに入力する必要があります。次のいずれかを更新できます。
lsfTypeinStockpickupodoaboutinventoryVerification
更新マスクに含まれていない属性は更新されません。
更新マスクに含まれているが、リクエストで設定されていない属性はクリアされます。
次のコードサンプルは、在庫確認フィールドを更新する方法を示しています。
package shopping.merchant.samples.accounts.v1;
// [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.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 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.v1;
// [START merchantapi_request_inventory_verification]
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 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/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 時間の遅延が発生します。
- 在庫チェックの失敗が 5 回以上繰り返された場合、サービスは 30 日間のクールダウン期間を適用してから、次のリクエストを許可します。早期の払い戻しをご希望の場合は、Google サポートにお問い合わせください。
その他の情報
詳しくは、ローカル在庫広告と無料ローカル リスティングのヘルプセンターをご覧ください。