Skip to main content

Using the create order consumer function in Sitecore CDP REST API

Abstract

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

You can use the Order Consumer REST API to perform the create order consumers function to create an OrderConsumer object. An order consumer represents a person who is consuming an order item.

To create order consumer(s) in Sitecore CDP, use the following:

POST: https://apiEndpoint/v2/orders/orderRef/consumers

Attribute

Description

Type

orderRef

The reference of the order.

string

$curl  --request POST 'https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE/consumers' \
--header 'Content-Type: application/json'  \
--data-raw '{
    "title": "Mr",
    "firstName": "Tom",
    "lastName": "Smith",
    "gender": "male",
    "guest": {
       "href": "http://{apiEndpoint}/v2/guests/567A697E-4E79-4F2C-96D1-A7249A44744F"
    },
    "orderItems": {
       "items" : [{
            "href": "http://{apiEndpoint}/v2/orderItems/FECBB7ED-6DFE-4E8C-85A9-B894B17EF4F3"
         }]
    }
}'

The following is a 201 response:

{
    "href": "http://{apiEndpoint}/v2/orderConsumers/C439E8B9-53F3-48BB-BD98-EE3657416FBE",
    "ref": "C439E8B9-53F3-48BB-BD98-EE3657416FBE",
    "createdAt": "2014-08-15T16:00:55.554Z",
    "modifiedAt": "2014-08-21T16:00:51.882Z",
    "title": "Mr",
    "firstName": "Tom",
    "lastName": "Smith",
    "gender": "male",
    "guest": {
       "href": "http://{apiEndpoint}/v2/guests/567A697E-4E79-4F2C-96D1-A7249A44744F"
    },
    "orderItems": {
       "items" : [{
             "href": "http://{apiEndpoint}/v2/orderItems/FECBB7ED-6DFE-4E8C-85A9-B894B17EF4F3"
        }]
   },
    "order": {
       "href": "http://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE"
    }
}