Skip to main content

Using the create order contact function in Sitecore CDP REST API

Abstract

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

You can use the Order Contact REST API to perform the create order contact function to create the primary contact on an order.

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

POST: https://apiEndpoint/v2/orders/{{order.ref}}/contacts

Attribute

Description

Type

firstName

The first name of the guest.

string

lastName

The last name of the guest.

string

$curl  --request POST 'https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE/contacts' \
--header 'Content-Type: application/json'  \
--data-raw '{
    "title": "Mr",
    "firstName": "Jack",
    "lastName": "Smith",
    "gender": "male",
    "dateOfBirth": "1976-10-28T00:00:00.000Z",
    "emails": [
        "jack.smith@boxever.com"
    ],
    "phoneNumbers": [
        "+353161123345",
        "+353861123345"
    ],
    "nationality": "Irish",
    "passportNumber": "PZ4A9565",
    "guest": {
        "href": "https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46"
    }
}' 

The following is a 201 response:

{
    "href": "https://{apiEndpoint}/v2/orderContacts/F8D1F0D5-365D-46B7-BECF-D041E93A5705",
    "ref": "F8D1F0D5-365D-46B7-BECF-D041E93A5705",
    "createdAt": "2014-08-15T16:00:55.554Z",
    "modifiedAt": "2014-08-21T16:00:51.882Z",
    "title": "Mr",
    "firstName": "Jack",
    "lastName": "Smith",
    "gender": "male",
    "dateOfBirth": "1976-10-28T00:00:00.000Z",
    "emails": [
        "jack.smith@boxever.com"
    ],
    "phoneNumbers": [
        "+353161123345",
        "+353861123345"
    ],
    "nationality": "Irish",
    "passportNumber": "PZ4A9565",
    "guest": {
        "href": "https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46"
    },
    "order": {
        "href": "https://{apiEndpoint}/v2/orders/056621C2-C955-492D-B7EE-C77C6BDDFDEE"
    }
}