---
title: "Work with the Catalog Entity Views and Actions API"
slug: "work-with-the-catalog-entity-views-and-actions-api"
abstract: "Overview of the Catalog Entity Actions and Views API used to exchange catalog-related data with other business systems."
---
# Work with the Catalog Entity Views and Actions API

External systems can exchange catalog-related information using the Catalog Entity Views and Actions API.

> [!note]
> The Views and Actions API is an [authoring API](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-commerce/authoring-api.html "Authoring API") designed to service a business user interface and is not optimized for integration scenario.
>
> You should consider the following when using the Views and Actions API for your commerce integration:
>
> -   The Views and Actions API can only process one Commerce entity at the time and does not support batch processing.
>
> -   The Views and Actions API carries more overhead than the Commerce web service API. A call to the Views and Action API is typically a 3-step process that requires getting the action's view, modifying the view's properties with updated values, and then executing the action.

<details>
<summary><h2>Get a catalog (C#)</h2></summary>

You can use the Entity Views and Actions API to retrieve a Commerce catalog using C#.

To retrieve a catalog:

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

```

</details>

<details>
<summary><h2>Create a catalog (C#)</h2></summary>

You can use the Entity Views and Actions API to create a new catalog using C#.

To create a catalog:

1. Get the entity view:

    ```csharp
    DataServiceQuerySingle<EntityView> query = container.GetEntityView($string.empty, "Details", "AddCatalog", string.Empty);
    EntityView view = Proxy.GetValue(query);
    ```

2. Provide the name and the display name of the new catalog:

    ```

    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. Execute the action:

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

</details>

<details>
<summary><h2>Update the details of a catalog  (C#)</h2></summary>

You can use the Entity Views and Actions API to modify information details related to a catalog.

To modify a catalog details using C#:

1. Get the entity view for the catalog details:

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

2. Provide the new catalog details, for example the catalog name or display name:

    ```

    var DisplayName = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));
    DisplayName.Value = "A Newly Renamed Catalog"
    ```

3. Execute the action:

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

</details>

<details>
<summary><h2>Delete a selected a catalog (C#)</h2></summary>

You can use the Entity Views and Actions API to delete a catalog using C#.

To delete a selected catalog:

1. Get the entity view for the catalog:

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

2. Execute the delete action:

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

</details>

<details>
<summary><h2>Get a category (C#)</h2></summary>

You can use the Entity Views and Actions API to retrieve a catalog category using C#.

To get a category:

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

```

</details>

<details>
<summary><h2>Create a category (C#)</h2></summary>

You can use the Entity Views and Actions API to create a catalog category using C#.

To create a catalog category:

1. Get the entity view:

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

2. Provide the new category details, including the name of the category, the display name, and a description, for example:

    ```

    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. Execute the action:

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

</details>

<details>
<summary><h2>Update a category (C#)</h2></summary>

You can use the Entity Views and Actions API to update the details of a category using C#.

To update the information details of a category:

1. Get the entity view:

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

2. Provide the new details for the category, for example the display name and the description:

    ```

    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. Execute the action:

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

</details>

<details>
<summary><h2>Delete a category (C#)</h2></summary>

You can use the Entity Views and Actions API to delete a category from a catalog, using C#.

To delete a category from a catalog:

1. Get the entity view and delete the catalog:

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

2. Execute the action:

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

</details>

<details>
<summary><h2>Disassociate a category (C#)</h2></summary>

You can use the Entity Views and Actions API to remove the association that links a category and a sub-category, for example to remove the association without deleting the category, using C#.

To remove the association:

1. Get the entity view:

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

2. Disassociate the category:

    ```text
    var action = view.Properties.FirstOrDefault(p =>; p.Name.Equals("DeleteOption")); action.Value = "Disassociate";
    ```

3. Execute the action: 

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

</details>