Skip to main content

Using the update guest data extension function in Sitecore CDP REST API

Abstract

Describes how to update the custom attributes of a guest by using the guest data extension function in Sitecore CDP REST API (Data model 2.1).

You can use the Guest REST API to perform the update guest data extension function to update the custom attributes of a guest stored in the guest data extension. To do this, you need the guestRef returned when you locate a guest data extension.

You must follow guest extension guidelines when using guest data extensions. To update a guest data extension in Sitecore CDP, use the following:

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

Attribute

Description

Type

guestRef

The unique ID of the guest generated by Sitecore CDP.

string

dataExtensionName

The data extension name.

string

dataExtensionRef

The reference of the data extension.

string

$curl  --request POST 'https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46/extExt/0349654D-5DB7-4103-8C9E-88953648EE18' \
 --header 'Content-Type: application/json' \
 --data-raw '{
    "key": "default",
    "format": "HTML",
    "acceptedTermsAndConditions": true,
    "shortDescription": "The email preferences for this guest",
    "longDescription": "The email preferences for this guest"
}' 

The following is the 200 response:

{
    "href": "https://{apiEndpoint}/v2/guests/9d94ee11-7043-4b71-980c-a777d00a7b46/extExt/0349654D-5DB7-4103-8C9E-88953648EE18",
    "ref": "0349654D-5DB7-4103-8C9E-88953648EE18",
    "createdAt": "2010-03-07T16:15:11.000Z",
    "modifiedAt": "2012-08-23T16:17:16.000Z",
    "key": "default",
    "format": "HTML",
    "acceptedTermsAndConditions": true,
    "shortDescription": "The email preferences for this guest",
    "longDescription": "The email preferences for this guest"
}