Meet us at Sitecore Symposium 2024 and Discover New Ways to Enhance Your Dynamics Experience. Book a Meeting
External systems can exchange order-related information using the Orders Entity Views and Actions API.
The Views and Actions API is an 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.
Authoring API
Commerce views are exposed via the Authoring API. This Authoring API is based on OData, but is significantly simplified and more dynamically structured to support a data-driven user experience.
The Authoring API targets authoring and management experiences, while the Shops API targets runtime experiences for a shop or storefront. The Authoring API is logically separated from the Shops API to allow more direct control over the availability of functionality in different engine roles.
For example, you may want the Authoring API to be accessible on an internal instance of the Commerce Engine, but not on the Commerce Engine instance that is serving storefronts.
Example of View and Action API
You can only add a line to an order when the status of the order is on hold.
To add a line item to a pending order using C#:
Get the entity view (the request must specify the order ID), for example:
DataServiceQuerySingle query = container.GetEntityView($”Entity-Order-{orderId}”, “AddLineItem”,
EntityView view = Proxy.GetValue(query);
Specify the line item property and the quantity, for example:
var itemProperty = view.Properties.FirstOrDefault(p => p.Name.Equals(“Item”));
Value = “Adventure Works Catalog|AW188-06|20”;
Execute the action:
CommerceCommand command = Proxy.DoCommand(container.DoAction(view));
As shown in above example, calls to the Orders Views and Actions API typically include the following steps:
Getting the action’s view.
Modifying the view’s properties values (as required).
Executing the action.
Note:
For any API calls to the XC Commerce Engine, you must:
Provide a valid authorization token.
Build or re-use a container class.
Let us have coffee together and discuss your requirement for sitecore experience commerce. Mail us at info@addact.net.
Unlock 40 hour of
free consultation with
our top experts now!