GenericSearch APIを使用したCommerceエンティティの検索

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Sitecore Experience Commerce SDKには、PostmanのSearchApiSamplesコレクションの一部としてGenericSearch APIコマンドが含まれています。サンプル要求を使用して、インデックス付きCommerceエンティティをCommerce Engineで検索できます。Searchプラグインは、汎用検索フレームワークの一部としてGenericSearch APIエンドポイントを定義します。GenericSearchクエリは、検索プロバイダーに依存しない構文を使用して構築します。カタログ品目、プロモーション、注文、プライス カード、または顧客を検索できます。

次の手順では、ここで説明するように、Postmanアプリケーションをインストールし、Sitecore Commerce Engine SDKからサンプル コレクションをインポートし、環境を設定し、Commerce Engine APIにアクセスするためのベアラー トークンを取得していることを前提としています。

GenericSearchサンプルを使用して、カタログ品目などのCommerceエンティティを検索するには:

  1. PostmanCollectionsウィンドウで、SearchAPISamplesコレクションを展開します。

  2. APIフォルダを開き、POST GenericSearchリクエスト({{ServiceHost}}/{{ShopsApi}}/GenericSearch())をクリックします。

  3. Bodyタブをクリックし、クエリ パラメーターを更新して検索クエリを作成します。次の例は、サンプルHabitat_Masterカタログで "InstaClix Instant Film Camera" という名前に一致するSellable商品を検索するために構築されたクエリを示しています。

    {
      "searchScope": "<hostname>-CatalogItemsScope",
      "searchQuery": null,
      "filterQuery": {
         "FilterNode": {
           "@odata.type": "#Sitecore.Commerce.Plugin.Search.EqualsFilterNode",
           "FieldName": {
             "@odata.type": "#Sitecore.Commerce.Plugin.Search.FieldNameFilterNode",
             "Name": "name"
           },
           "FieldValue": {
             "@odata.type": "#Sitecore.Commerce.Plugin.Search.FieldValueFilterNode",
             "Value": "Habitat_Master",
             "ValueType": "1"
           }
        }
     },
     "searchOptions": {
        "Skip": "0",
        "Top": "3",
        "ResultsOrderFields": [],
        "FieldsToRetrieve": []
      }
    }
  4. Send」をクリックします。次に、返された検索結果の例を示します。

    {
      "@odata.context": "https://cqa-dem-01-dk1:5000/api/$metadata#Collection(Sitecore.Commerce.Plugin.Search.SearchResult)", 
      "value": [
         {
           "Fields": [
              
                "Key": "sitecoreid",
                "Value": "46455327-796c-8125-b838-f6d7f678303d"
              },
              {
                "Key": "entityuniqueid",
                "Value": "6d737cc2-333b-ae32-73f0-cc3d67631409"
              },
              {
                "Key": "entityid",
                "Value": "Entity-SellableItem-7042066"
              },
              {
                "Key": "entityversion",
                "Value": "1"
              },
              
                "Key": "productid",  
                "Value": "7042066" 
              },  
              {
                "Key": "displayname",
                "Value": "InstaClix Instant Film Camera"
              },
              {
                "Key": "name",
                "Value": "InstaClix Instant Film Cmera"
              },
              {
                "Key": "datecreated",  
                "Value": "5/16/2019 2:09:35 PM +00:00"
              },
              {
                 "Key": "dateupdated",
                 "Value": "2/29/2020 10:57:28 AM +00:00"
              },
              {
                 "Key": "artifactstoreid",
                 "Value": "78a1ea61-1f37-42a7-ac89-9a3f46d60ca5"
              },
              {
                 "Key": "parentcataloglist",
                 "Value": "[\"59ddadc1-9b88-727e-9e14-3f6cf321ae0f\"]"
              },
              {
                 "Key": "variantid",
                 "Value": "57042066|57042067|57042068|
    57042069|57042070"
              },
              {
                 "Key": "variantdisplayname",
                 "Value": "InstaClix Instant Film Camera
    (Blue)|InstaClix Instant Film Camera (Red)| InstaClix Instant Film Camera (Green)|InstaClix Instant Film Camera (Teal)|InstaClix Instant Film Camera (Pink)"
               },
               { 
                 "Key": "inventorysetids",  
                 "Value": "Entity-InventorySet-Habitat_Inventory" 
               },
               {
                 "Key": "_version_",  
                 "Value": "1659868448064274437"
               }
            ]
         }
      ]
    }
メモ

汎用検索フレームワークは、クエリの作成に使用できる検索ノードとフィルター ノード、条件、および演算子を定義します。

この記事を改善するための提案がある場合は、 お知らせください!