Using the retrieve order expand order items function in Sitecore CDP REST API

Abstract

Provides a cURL command to retrieve an expanded order in Sitecore CDP REST API (Data model 2.0).

You can use the Order REST API to perform the retrieve order expand function to retrieve the order as well as order items contained in the declared order entity. To do this, you need the orderRef attribute from when you locate orders.

To retrieve an expanded order in the Sitecore CDP, use the following:

GET: https://apiEndpoint/v2/orders/orderRef?expand=:entity

Attribute

Description

Type

orderRef

The order reference number.

string

The :entity attribute in the query parameter is the entity to expand and is a string type.

$ curl -H "Accept: application/json" \
     "https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE?expand=orderItems"

The following is a 200 response:

{
    "href":"https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE?expand=orderItems",
    "ref":"056621C2-C955-492D-B7EE-C77C6BDDFDEE",
    "createdAt":"2014-08-15T16:00:55.554Z",
    "modifiedAt":"2014-08-21T16:00:51.882Z",
    "orderedAt":"2014-08-15T16:00:55.554Z",
    "price": 100.00,
    "currencyCode":"EUR",
    "referenceId": "B94TXY",
    "paymentType": "Card",
    "cardType": "Visa",
    "pointOfSale": "default",
    "channel": "WEB",
    "status": "PURCHASED",
    "contacts":{
        "href":"https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE/contacts"
    },
    "consumers":{
        "href":"https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE/consumers"
    },
    "orderItems":{
        "href":"https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE/orderItems",
        "offset":0,
        "limit":10,
        "items":[
            {
                "href":"https://{apiEndpoint}/v2/orderItems/FECBB7ED-6DFE-4E8C-85A9-B894B17EF4F3",
                "ref":"FECBB7ED-6DFE-4E8C-85A9-B894B17EF4F3",
                "createdAt":"2014-08-15T16:00:55.554Z",
                "modifiedAt":"2014-08-21T16:00:51.882Z",
                "type":"FLIGHT",
                "quantity":1,
                "productId":"DUB-LHR",
                "price":100.00,
                "currencyCode":"EUR",
                "originalPrice":112.00,
                "originalCurrencyCode":"USD",
                "referenceId":"B94TXY",
                "status":"PURCHASED",
                "passengerTypeCode":"ADT",
                "flightSegments":[
                    {
                        "origin":"DUB",
                        "destination":"LHR",
                        "departureDateTime":"2016-08-15T16:00:00.000Z",
                        "arrivalDateTime":"2016-08-15T17:20:00.000Z",
                        "flightNumber":"459",
                        "fareClass":"Economy",
                        "fareFamily":"Plus",
                        "carrier":"BX",
                        "operatingCarrier":"BX",
                        "originDestination":"DUB-LHR"
                    },
                    {
                        "origin":"LHR",
                        "destination":"LAS",
                        "departureDateTime":"2016-08-15T20:00:00.000Z",
                        "arrivalDateTime":"2016-08-15T22:40:00.000Z",
                        "flightNumber":"460",
                        "fareClass":"Economy",
                        "fareFamily":"Plus",
                        "carrier":"BX",
                        "operatingCarrier":"BX",
                        "originDestination":"LHR-LAS"
                    }
                ]
            }
        ],
        "order":{
            "href":"https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE"
        }
    }
}