Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Orders API handler

Return a collection of orders.

HTTP Verb – GET

URL – /api/v1/orders

Description – Return a collection of orders

Base – HandlerBase<GetOrderCollectionParameter, GetOrderCollectionResult>

Handlers

OrderHandlerDescription
500GetRealTimeOrderCollectionHandlerIf this is not a real time request (checks the application setting "RealTimeCallsEnabled" and "Web_UseRealTimeOrderHistory"), then moves on to the next handler. If there are no job definitions for real time orders or job definition steps or job definition step parameters that have a customer number prompt, then a Not Found error message is returned. Otherwise gets the collection of orders from running the real time job. If none are returned, then Not Found error message is returned.
550GetStoredOrderCollectionHandlerIf this is a real time request, then just moves on to the next handler. Otherwise, gets a collection of orders based on "ERP_LookBackDays" and paging/filtering values.

HTTP Verb – GET

URL – /api/v1/orders/{orderid}

Description – Return a single order record

Base – HandlerBase<GetOrderParameter, GetOrderResult>

Handlers

OrderHandlerDescription
500GetRealTimeOrderHandlerIf this is not a real time request (checks the application setting "RealTimeCallsEnabled" and "Web_UseRealTimeOrderHistory"), then moves on to the next handler. If there are no job definitions for real time orders or job definition steps or job definition step parameters that have a customer number prompt or job definition step parameters for an order number prompt, then a Not Found error message is returned. Otherwise gets the order from running the real time job for the matching ordered/ordernumber.
550GetStoredOrderHandlerIf this is a real time request, then just moves on to the next handler. Otherwise, gets a collection of orders based on the matching ordered/ordernumber and bill to customer.

HTTP Verb – GET

URL – /api/v1/orders/{orderid}

Description – Return a single order record

Base – HandlerBase<GetOrderParameter, GetOrderResult>

Handlers

OrderHandlerDescription
500GetSettingsPopulate IsRealTime, ReturnReasons and GetOrderLines properties of the result object
600GetRealTimeJobDefinitionGets real time order historydetail integration job and sets its parameters, if IsRealTime equals "true".
700ExecuteRealTimeJobExecutes real time order history detail integration job and save result dataset to RealTimeDataSet property on the result object, if IsRealTime equals "true".
800MapRealTimeDataSetParses OrderHistory and OrderHistoryLine dataset's tables and creates OrderHistory and OrderHistoryLine lists, which are saved as OrderHistory property, if IsRealTime equals "true".
900GetStoredOrderHistoryGets OrderHistory with OrderHistoryLine by OrderNumber and current customer number, save it to OrderHistory property and populate ShipViaDescription if OrderHistory has ShipCode, if IsRealTime equals "false".
1000GetLinesIf GetOrderLines property of the parameter object equals "true", maps OrderHistoryLines to GetOrderLineResults property on the result object and populates CanAddToCart, CanAddAllToCart, ShowTaxAndShipping properties of the result object.
1100GetShipmentsIf GetShipments property of the parameter object equals "true", populates Shipments property of the result object by order history ErpOrderNumber or WebOrderNumber using shipmentService.
1200GetCurrencyPopulate Currency property on the result object by OrderHistory's CurrencyCode.
1300GetStatusMappingPopulate OrderStatusMapping property on the result object by OrderHistory's Status.
1400CopyCustomPropertiesToResultCopy order history custom properties and order history lines custom properties to the result object.

HTTP Verb – GET

URL – /api/v1/orders

Description – Return a collection of orders

Base – HandlerBase<GetOrderCollectionParameter, GetOrderCollectionResult>

Handlers

OrderHandlerDescription
500GetSettingsPopulate IsRealTime, ShowErpOrderNumber and GetOrderLines property of the result object
600GetRealTimeJobDefinitionGets real time order history integration job and sets its parameters, if IsRealTime equals "true".
700ExecuteRealTimeJobExecutes real time order history integration job and save result dataset into RealTimeDataSet property of the result object, if IsRealTime equals "true".
800MapRealTimeDataSetParses OrderHistory and OrderHistoryLine dataset's tables and creates OrderHistory and OrderHistoryLine lists, which are saved as OrdersQuery property, if IsRealTime equals "true".
900GetStoredCollectionQueryGets all OrderHistories with OrderHistoryLines, which belong to current customer, and save them to OrdersQuery, if IsRealTime equals "false".
1000ApplyFilteringToStoredCollectionQueryFilters the OrdersQuery, if specified in the parameter and IsRealTime equals "false".
If StatusCollection property has any statuses, returns OrderHistories if StatusCollection contains their status.
If OrderNumberproperty has value, returns OrderHistories if their order number equals OrderNumber property.
If OrderNumber property has value, returns OrderHistories if their order number equals OrderNumber property.
If CustomerPO property has value, returns OrderHistories if their CustomerPO equals CustomerPO property.
If CustomerSequence property doesn't equal "-1", returns OrderHistories if their CustomerSequence equals CustomerSequence property or empty.
If ToDate property has value, returns OrderHistories if their OrderDate less or equals ToDate property.
If FromDate property has value, returns OrderHistories if their OrderDate more or equals FromDate property.
If OrderTotalOperator property has value, returns OrderHistories if their OrderTotal meets OrderTotalOperator property.
If Search property has value, returns OrderHistories if their properties contain Search property
1100ApplySortApplies a sort to the OrdersQuery. The query is sorted using the Sort property on the parameter object (in ascending order), otherwise the query is sorted by OrderDate (in descending order).
1200ApplyPagingApplies paging to the OrdersQuery. If the PageSize property on the parameter object has a value, the query is paged using the PageSize and Page properties on the parameter object.
1300ExecuteQueryExecutes the OrdersQuery after the query has been filtered, sorted, and paged. The result is stored in the OrderHistoryCollection property on the result object.
1400CreateGetOrderResultsIf OrderHistoryCollection property on the result object has values, they are transformed into a collection of OrderHistoryCollection objects using the GetOrderHandler handler. The result is stored in the GetOrderResults property on the result object.

HTTP Verb – GET

URL – /api/v1/orders/{orderid}?expand=shipments

Description – Gets the shipments for the order.

Base – HandlerBase<GetShipmentCollectionParameter, GetShipmentCollectionResult>

Handlers

OrderHandlerDescription
500GetShipmentQueryCreates the shipment query that returns list of shipments by WebOrderNumber or ErpOrderNumber. The query is stored in the ShipmentQuery property on the result object.
600ApplySortApplies sorting to the ShipmentQuery property on the result object. If the Sort property on the parameter object has a value, the query will be sorted with that value. If the Sort property is empty, the query will be sorted by the ShipmentNumber property.
700ApplyPagingApplies paging to the ShipmentQuery. If the PageSize property on the parameter object has a value, the query is paged using the PageSize and Page properties on the parameter object.
800ExecuteQueryExecutes the ShipmentQuery after the query has been expanded, filtered, sorted, and paged. The result is stored in the Shipments property on the result object.
900CreateShipmentDtosIf the Shipments property has values on the result object, they are transformed into a collection of getShipmentResult objects using the shipmentService. The result is stored in the ShipmentDtos property on the result object.

HTTP Verb – PATCH

URL – /api/v1/orders/{orderid}

Description – Updates a single order

Base – HandlerBase<UpdateOrderParameter, UpdateOrderResult>

Handlers

OrderHandlerDescription
500UpdateOrderRetrieves an order using the OrderNumber property on the parameter object. If a order is not found, an error is returned. If parameter object has Status property, updates order status. Retrieves OrderStatusMapping according to the status. The order is stored in the OrderResult property on the result object.

HTTP Verb – POST

URL – /api/v1/orders/{orderid}/returns

Description – Creates and sends an RMA request email

Base – HandlerBase<AddRmaParameter, AddRmaResult>

Handlers

OrderHandlerDescription
500AddRmaHandlerIf there is no logged in user or customer then Not Found error result is returned. If there are any invalid rma order lines, then validation messages are returned. Otherwise, creates and sends an email with the RMA request.
OrderHandlerDescription
500ValidateContextValidates UserProfileDto or Customer is not null in site context, otherwise return NotFound
600ValidateRmaValidates each RMA line quantity and also reasonCode, if code is required.
700PopulateEmailModelPopulates EmailModel property on the result object by order's and orderLines' information.
800SendEmailSends "Request RMA" email using email service.