Skip to main content

Using the create order function in Sitecore CDP REST API

Abstract

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

You can use the Order REST API to perform a create order function to create an order. An order is the parent object of one or more order items.

To create an order in Sitecore CDP, use the following:

POST: https://apiEndpoint/v2/orders

$curl  --request POST 'https://{apiEndpoint}/v2/orders’ \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "orderedAt": "2014-08-15T16:00:55.554Z",
    "price": 100.00,
    "currencyCode": "EUR",
    "referenceId": "B94TXY",
    "paymentType": "Card",
    "cardType": "Visa",
    "pointOfSale": "default",
    "channel": "WEB",
    "status": "PURCHASED"
}'

The following is a 200 response:

{
    "href": "https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE",
    "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"
    }
}