1. カタログ統合

カタログ エンティティ ビューとアクションAPIの操作

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

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

外部システムは、Catalog Entity Views and Actions APIを使用してカタログ関連情報を交換できます。

メモ

Views and Actions APIは、ビジネス・ユーザー・インターフェースを提供するように設計された オーサリングAPIであり、統合シナリオ用には最適化されていません。

コマース統合にViews and Actions APIを使用する場合は、次の点を考慮する必要があります。

  • Views and Actions APIは、一度に1つのCommerceエンティティのみを処理でき、バッチ処理をサポートしていません。

  • Views and Actions APIは、Commerce WebサービスAPIよりも多くのオーバーヘッドを伴います。Views and Action APIの呼び出しは、通常、アクションのビューを取得し、更新された値でビューのプロパティを変更してから、アクションを実行する必要がある3段階のプロセスです。

カタログを取得する (C#)

Entity Views and Actions APIを使用して、C# でCommerceカタログを取得できます。

カタログを取得するには:

DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-Catalog-{Id}", "Master", string.Empty, "Entity-Catalog-{CatalogId}");
EntityView view = Proxy.GetValue(query);

カタログの作成 (C#)

Entity Views and Actions APIを使用して、C# で新しいカタログを作成できます。

カタログを作成するには:

  1. エンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($string.empty, "Details", "AddCatalog", string.Empty);
    EntityView view = Proxy.GetValue(query);
  2. 新しいカタログの名前と表示名を指定します。

    var Name = view.Properties.FirstOrDefault(p => p.Name.Equals("Name"));
    var DisplayName = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));
    Name.Value = "ANewCatalog";
    DisplayName.Value = "A New Catalog";
  3. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

カタログの詳細を更新する (C#)

Entity Views and Actions APIを使用して、カタログに関連する情報の詳細を変更できます。

C# を使用してカタログの詳細を変更するには:

  1. カタログの詳細のエンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-Catalog-{CatalogId}",  Details", "EditCatalog", string.Empty);
    EntityView view = Proxy.GetValue(query);
  2. 新しいカタログの詳細 (カタログ名や表示名など) を指定します。

    var DisplayName = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));	
    DisplayName.Value = "A Newly Renamed Catalog"
  3. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

選択したカタログの削除 (C#)

Entity Views and Actions APIを使用して、C# でカタログを削除できます。

選択したカタログを削除するには:

  1. カタログのエンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"",string.Empty,"DeleteCatalog", "Entity-Catalog-{CatalogId}");
    EntityView view = Proxy.GetValue(query);
  2. 削除アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

カテゴリを取得する (C#)

Entity Views and Actions APIを使用して、C# でカタログ カテゴリを取得できます。

カテゴリを取得するには:

DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-{ParentType}-{ParentId}", string.Empty, string.Empty, "Entity-Category-{CategoryId}");
EntityView view = Proxy.GetValue(query);

カテゴリの作成 (C#)

Entity Views and Actions APIを使用して、C# でカタログ カテゴリを作成できます。

カタログカテゴリを作成するには:

  1. エンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-{ParentType}-{ParentId}", "Details", "AddCategory", string.Empty);
    EntityView view = Proxy.GetValue(query);
  2. 新しいカテゴリの詳細 (カテゴリの名前、表示名、説明など) を入力します。

    var Name = view.Properties.FirstOrDefault(p => p.Name.Equals("Name"));
    var DisplayName = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));
    var Description = view.Properties.FirstOrDefault(p => p.Name.Equals("Description"));
    
    Name.Value = "ANewCategory";
    DisplayName.Value = "A New Category";
    Description.Value = "A Category to hold samples";
  3. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

カテゴリの更新 (C#)

Entity Views and Actions APIを使用すると、C# でカテゴリの詳細を更新できます。

カテゴリの情報の詳細を更新するには:

  1. エンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-Category-{CategoryId}", "Details", "EditCategory", string.Empty); EntityView view = Proxy.GetValue(query);
  2. カテゴリの新しい詳細 (表示名や説明など) を入力します。

    var DisplayName = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));
    var Description = view.Properties.FirstOrDefault(p => p.Name.Equals("Description"));
    
    DisplayName.Value = "Even Hotter Stuff Category";
    Description.Value = "Like the Sun Steel Works";
  3. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

カテゴリの削除 (C#)

Entity Views and Actions APIを使用すると、C# を使用してカタログからカテゴリを削除できます。

カタログからカテゴリを削除するには:

  1. エンティティ ビューを取得し、カタログを削除します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-{ParentType}-{ParentId}",string.Empty,"DeleteCategory","Entity-Category-{CategoryId}");
    EntityView view = Proxy.GetValue(query);
  2. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));

カテゴリの関連付けを解除する (C#)

Entity Views and Actions APIを使用すると、カテゴリとサブカテゴリをリンクする関連付けを削除できます (たとえば、C# を使用してカテゴリを削除せずに関連付けを削除できます)。

関連付けを削除するには:

  1. エンティティ ビューを取得します。

    DataServiceQuerySingle<EntityView> query = container.GetEntityView($"Entity-{ParentType}-{ParentId}",string.Empty,"DeleteCategory","Entity-Category-{CategoryId}");	
    EntityView view = Proxy.GetValue(query);
  2. カテゴリの関連付けを解除します。

    var action = view.Properties.FirstOrDefault(p =>; p.Name.Equals("DeleteOption")); action.Value = "Disassociate";
  3. アクションを実行します。

    CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
この記事を改善するための提案がある場合は、 お知らせください!