Work with the Orders Entity Views and Actions API (C#)
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.
As shown in this 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.
For any API calls to the XC Commerce Engine, you must:
Work with Orders using the Entity Views and Actions API (C#)
You can use the Entity Views and Actions API to perform the following orders-related operations:
Put an order on hold (C#)
Put an order on hold (C#)
You can only put an order on hold when the order status is pending.
To put an order on hold using C#:
-
Get the entity view for the action, for example:
-
Execute the action:
Delete an order line (C#)
Delete an order line (C#)
You can delete an order line when the order status is pending.
To delete a line from a pending order using C#:
-
Get the entity view for the action, for example:
-
Execute the action:
Add an order line (C#)
Add an order line (C#)
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:
-
Specify the line item property and the quantity, for example:
-
Execute the action:
Edit an order line (C#)
Edit an order line (C#)
You can only edit an order line when the status of the order is on hold.
To modify an order line, for example, change a line item quantity to 5:
-
Get the entity view for the action for a given order (the request must specify the order ID and the line item ID), for example:
-
Modify the quantity of the line item to 5 :
-
Execute the action:
Release an order from hold (C#)
Release an order from hold (C#)
To release an order from the on hold status:
-
Get the entity view for the action, for example:
-
Execute the action:
NoteAfter it has been released, the order returns to the pending status.
Undo changes made to an order (C#)
Undo changes made to an order (C#)
To undo changes made to an order (while it was on hold):
-
Get the entity view for the action, for example:
-
Execute the action:
NoteAfter you undo the changes, the order remains on hold.
Cancel hold on an order (C#)
Cancel hold on an order (C#)
To cancel the hold on an order using C#:
-
Get the entity view for the action, for example:
-
Execute the action:
After you cancel the hold, the order returns to the Pending status.
Cancel an order (C#)
Cancel an order (C#)
You can only cancel orders that are in the pending status.
To cancel a pending order using C#:
-
Get the entity view for the action, for example:
-
Execute the action:
NoteAfter you cancel the hold, the order status changes to cancelled.
Return an item (C#)
Return an item (C#)
You can perform a return merchandise authorization (RMA) request programmatically using the Entity Views and Actions API.
You can request an RMA when an order status is completed.
To perform a RMA request on an order line item using C#:
-
Specify the reason for returning the item, as well as the quantity of this line item to return. In the following example, the reason for returning is wrong Item. The quantity returned is 1.
-
Confirm to proceed with the return request.
-
Execute the action: