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

Sitecore Experience Commerce can exchange product-related data with other business systems 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/103/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 sellable item (C#)</h2></summary>

The following example shows how to get a sellable item using C#:

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

```

</details>

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

The following example shows how to create a sellable item using C#:

1. Get the entity view:

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

2. Specify the sellable item properties:

    ```

    var ProductId = view.Properties.FirstOrDefault(p => p.Name.Equals("ProductId"));
    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"));
    var Brand = view.Properties.FirstOrDefault(p => p.Name.Equals("Brand"));
    var Manufacturer = view.Properties.FirstOrDefault(p => p.Name.Equals("Manufacturer"));
    var TypeOfGood = view.Properties.FirstOrDefault(p => p.Name.Equals("TypeOfGood"));

    ProductId.Value = "SomeProductId".ProposeValidId(); //ProposeValidId will try to convert your string to a safe string to use.
    Name.Value = "AHotProduct";
    DisplayName.Value = "A Hot New Product";
    Description.Value = "The hottest product on the market today";
    Brand.Value = "Hot Stuff Brands";
    Manufacturer.Value = "Hot Stuff Manufacturers";
    TypeOfGood.Value = "Physical Item";
    ```

3. Execute the action:

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

</details>

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

The following example shows how to delete a sellable item using C#:

1. Get the entity view: 

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

2. Delete the sellable item:

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

3. Execute the action:

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

</details>

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

The following example shows how you can use the Entity Views and Actions API to update the details of a sellable item using C#:

1. Get the entity view:

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

2. Modify the view's property with the details to update:

    ```

    var displayNameProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("DisplayName"));
    displayNameProperty.Value = "Edited Display Name";
    var descriptionProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Description"));
    descriptionProperty.Value = "Edited Description";
    var brandProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Brand"));
    brandProperty.Value = "Edited Brand";
    var manufacturerProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Manufacturer"));
    manufacturerProperty.Value = "Edited Manufacturer";
    var typeOfGoodProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("TypeOfGood"));
    typeOfGoodProperty.Value = "Edited TypeOfGood";
    var tagsProperty = view.Properties.FirstOrDefault(p => p.Name.Equals("Tags"));
    typeOfGoodProperty.Value = "['Tag1', 'Tag2', 'Tag3']";
    ```

3. Execute the action:

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

</details>

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

The following example shows how you can use the Entity Views and Actions API to disassociate a sellable item (for example, from a  category), using C#:

1. Get the entity view:

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

2. Disassociate the sellable item:

    ```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>