プロダクトを移行する

Merchant API では、商品データをより堅牢かつ直感的に管理できるようになりました。主な変更点は、商品データが 2 つの異なる リソースに分割されたことです。ProductInput はデータを送信するためのリソース、Product は商品ステータスや問題など、 処理後の最終バージョンを表示するためのリソースです。この新しい構造により、予測可能性と透明性が向上します。

このガイドでは、Content API for Shopping からの統合を移行するうえで重要な違いについて説明します。新しい機能の使用方法について詳しくは、商品を管理するをご覧ください。

主な違い

Merchant API での商品管理は、Content API for Shopping と比べて次のような点が大きく異なります。

    をご覧ください。
  • 任意のフィードラベルと言語のデータソース: Merchant API では、 フィードラベルと言語を指定せずにデータソースを作成できるため 、任意のフィードラベルと言語で商品を挿入できます。

リクエスト

このセクションでは、Content API for Shopping と Merchant API のリクエスト形式を比較します。

リクエストの説明 Content API for Shopping Merchant API
商品を入手する GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId} GET https://merchantapi.googleapis.com/products/v1/accounts/{account}/products/{product}
商品を一覧表示する GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products GET https://merchantapi.googleapis.com/products/v1/accounts/{account}/products
商品を挿入する POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products POST https://merchantapi.googleapis.com/products/v1/accounts/{account}/productInputs:insert
商品を更新する PATCH https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId} PATCH https://merchantapi.googleapis.com/products/v1/accounts/{account}/productInputs/{productinput}
商品を削除する DELETE https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId} DELETE https://merchantapi.googleapis.com/products/v1/accounts/{account}/productInputs/{productinput}
商品ステータスを取得する GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/productstatuses/{productId} GET https://merchantapi.googleapis.com/products/v1/accounts/{account}/products/{product}
商品ステータスを一覧表示する GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/productstatuses GET https://merchantapi.googleapis.com/products/v1/accounts/{account}/products
複数のリクエストをバッチ処理する POST https://shoppingcontent.googleapis.com/content/v2.1/products/custombatch 非同期リクエストまたは HTTP バッチ処理を使用する

識別子

Merchant API では、商品 ID の形式が標準の REST リソース名に変更されました。

識別子の説明 Content API for Shopping Merchant API
商品 ID コロン(:)で区切られたセグメントで構成される文字列。
形式: channel:contentLanguage:targetCountry:offerId または channel:contentLanguage:feedLabel:offerId
例: online:en:US:sku123
REST リソース name 文字列。形式: accounts/{account}/products/{product}。ここで、{product}contentLanguage~feedLabel~offerId です。例: accounts/12345/products/en~US~sku123。エンコード: パディングなしの base64url エンコード を推奨します。商品 ID に Merchant API で使用される文字や URL 予約文字が含まれている場合は必須 です。


メソッド

次の表に、Content API for Shopping のメソッドと、Merchant API での対応するメソッドを示します。

Content API for Shopping メソッド Merchant API メソッド 提供状況と注意事項
products.get products.get 処理済みの最終的な商品を取得します。
products.list products.list 処理済みの最終的な商品を一覧表示します。
products.insert productInputs.insert 商品入力を挿入します。dataSource が必要です。
products.update productInputs.patch 動作が大きく異なります。特定の商品入力を更新し、永続化します。
products.delete productInputs.delete 特定の商品入力を削除します。dataSource が必要です。
products.custombatch 利用不可 非同期リクエストまたは HTTP バッチ処理を使用します。
productstatuses.get products.get productstatuses サービスが削除されました。ステータス情報は Product リソースの一部になりました。
productstatuses.list products.list productstatuses サービスが削除されました。ステータス情報は Product リソースの一部になりました。
productstatuses.custombatch 利用不可 非同期リクエストまたはHTTP バッチ処理を使用します。

フィールドの詳細な変更点

次の表に、Merchant API で変更、追加、削除された重要なフィールドを示します。

Content API for Shopping Merchant API 説明
id name 商品のプライマリ ID は REST リソース name になりました。商品名に Merchant API で使用される文字や URL 予約文字が含まれている場合は、パディングなしの base64url エンコード を推奨します。必須
トップレベルの商品データ仕様属性(titlepricelink など) productAttributes オブジェクト titlepricelink などの商品属性は、トップレベルのフィールドではなくなりました。Product リソースと ProductInput リソースの両方で、productAttributes オブジェクト内にグループ化されています。これにより、リソース構造がよりシンプルで整理されたものになります。
targetCountry feedLabel リソース名は、Merchant Center の機能に合わせて targetCountry ではなく feedLabel を使用するようになりました。
feedId dataSource(クエリ パラメータ) dataSource 名は、すべての productInputs 書き込みメソッド(insertupdatedelete)で必須のクエリ パラメータになりました。
channel 利用できません。ローカルのみの商品には legacy_local を使用してください。 Merchant API に channel フィールドはなくなりました。Content API for Shopping で LOCAL チャネルを使用している商品は、代わりに legacy_local フィールドを true に設定する必要があります。
利用不可 versionNumber ProductInput の新しい省略可能なフィールド。プライマリ データソースへの順序が正しくない挿入を防ぐために使用できます。
定義済みの値のセットを持つ string 型のフィールド 定義済みの値のセットを持つ enum 型のフィールド 定義済みの値のセットを持つ商品属性内のフィールド(excluded_destinationsavailability など)は、enum 型になりました。