Skip to main content

Use the update guest function in Sitecore CDP REST API

Abstract

Provides a cURL command to update a guest in Sitecore CDP REST API (Data model 2.0).

You can use the Guest REST API to perform an update guest function to update the attributes of a guest.

Before you do this, you can use the locate guest function to find a guest using their email address or other identifying information, then use the guestRef included in the response to retrieve the full guest record.

To update a guest in Sitecore CDP, use the following:

POST https://apiEndpoint/v2/guests/guestRef

Attribute

Description

Type

guestRef

The reference of the guest record.

string

Update a guest using Personally Identifiable Information (PII):

$curl  --request POST 'https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46' \
--header 'Content-Type: application/json'  \
--data-raw '{
    "guestType": "customer",
    "title": "Mr",
    "firstName": "Jack",
    "lastName": "Smith",
    "gender": "male",
    "dateOfBirth": "1976-10-28T00:00:00.000Z",
    "emails": [
        "jack.smith@boxever.com"
    ],
    "phoneNumbers": [
        "0851234567"
    ],
    "nationality": "Irish",
    "passportNumber": "PZ4A9565",
    "passportExpiry": "2019-01-01T00:00:00.000Z",
    "street": [
        "Apartment 15",
        "West Drive Avenue"
    ],
    "city": "Dublin",
    "country": "IE",
    "postCode": "D2",
    "state": "Dublin",
    "subscriptions": [
        {
            "name": "default",
            "channel": "EMAIL",
            "pointOfSale": "default",
            "status": "SUBSCRIBED",
            "effectiveDate": "2012-08-23T16:17:16.000Z"
        }
    ],
    "identifiers": [
    ]
}' 

Update a guest using the identifiers object:

$curl  --request POST 'https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46' \
--header 'Content-Type: application/json'  \
--data-raw '{
   "guestType":"customer",
   "subscriptions":[
      {
         "name":"default",
         "channel":"EMAIL",
         "pointOfSale":"default",
         "status":"SUBSCRIBED",
         "effectiveDate":"2012-08-23T16:17:16.000Z"
      }
   ],
   "identifiers":[
      {
         "provider":"ProfileSystem",
         "id":"B7524AE6-CF1C-440F-B1A2-0C9D42F5CB41",
         "expiryDate":"2016-08-23T16:17:16.000Z"
      }
   ]
}' 

The following is a 201 Created response with Personally Identifiable Information (PII):

{
    "href": "https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46",
    "ref": "9d94ee11-7043-4b71-980c-a777d00a7b46",
    "createdAt": "2010-03-07T16:15:11.000Z",
    "modifiedAt": "2012-08-23T16:17:16.000Z",
    "firstSeen": "2010-03-07T16:15:11.000Z",
    "lastSeen": "2012-08-23T16:17:16.000Z",
    "guestType": "customer",
    "title": "Mr",
    "firstName": "Jack",
    "lastName": "Smith",
    "gender": "male",
    "dateOfBirth": "1976-10-28T00:00:00.000Z",
    "emails": [
        "jack.smith@boxever.com"
    ],
    "phoneNumbers": [
        "0851234567"
    ],
    "nationality": "Irish",
    "passportNumber": "PZ4A9565",
    "passportExpiry": "2019-01-01T00:00:00.000Z",
    "street": [
        "Apartment 15",
        "West Drive Avenue"
    ],
    "city": "Dublin",
    "country": "Ireland",
    "postCode": "D2",
    "state": "Dublin",
    "subscriptions": [
        {
            "name": "default",
            "channel": "EMAIL",
            "pointOfSale": "default",
            "status": "SUBSCRIBED",
            "effectiveDate": "2012-08-23T16:17:16.000Z"
        }
    ],
    "identifiers": [
    ]
}

The following is a 201 Created response with identifiers:

{
   "href":"https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46",
   "ref":"9d94ee11-7043-4b71-980c-a777d00a7b46",
   "createdAt":"2010-03-07T16:15:11.000Z",
   "modifiedAt":"2012-08-23T16:17:16.000Z",
   "firstSeen":"2010-03-07T16:15:11.000Z",
   "lastSeen":"2012-08-23T16:17:16.000Z",
   "guestType":"customer",
   "subscriptions":[
      {
         "name":"default",
         "channel":"EMAIL",
         "pointOfSale":"default",
         "status":"SUBSCRIBED",
         "effectiveDate":"2012-08-23T16:17:16.000Z"
      }
   ],
   "identifiers":[
      {
         "provider":"ProfileSystem",
         "id":"B7524AE6-CF1C-440F-B1A2-0C9D42F5CB41",
         "expiryDate":"2016-08-23T16:17:16.000Z"
      }
   ]
}