Get preferences for the current user
Get preferences for the current user¶
To retrieve the preferences for a specified user under the specified WidgetID, you can use a GET request to the designated endpoint /preferences that accepts following parameters as input:
Parameters:
widgetUuid(required): Widget UUID of the widget that contain preference data objectx-user-id: (required) UserID of the user who submitted the preferenceslanguage: (optional): A language code in ISO 639-1 format (e.g., 'en'), indicating which translation variant of the selected preferences is expected to be returned. (If not defined, English will be returned.)
Example:
curl -X 'GET' \
'https://preference-api.preference-management.usercentrics.eu/public/preferences?widgetUuid=1234abcd-22bb-33cc-44dd-12345678abcd&language=de' \
-H 'accept: application/json' \
-H 'x-user-id: user@company.com' \
-H 'X-API-KEY: 7b931a0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa0d1'
Comparing to /preference/my, in this case only one preference object will be returned as a response, however, it will contain the same set of data enhanced with the translation variant of the selected options and topics:
uuid- ID of the specific preference data objectwidgetUuid- ID of the Widget this object was submitted underwidgetName- title of the widget in the language selectedpending- Boolean flag, if these preferences are in a pending state (in case the DoubleOptIn feature is activated and the preferences not yet confirmed by the user)answers- the object containing currently selected preferences wheretopicUuidrefers to the Topic ID under the set of options (topicAnswersUuid) that are selected. In addition, the object contains theTopicNameandanswerNamefields, which represent the title of the topic and selected option in the language selected, respectively.
Response:
[
{
"widgetName": "Kommunikationspräferenzen",
"widgetUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"answers": [
{
"topicName": "Newsletter-Themen",
"topicUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"topicAnswerUuids": [
{
"answerUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"answerName": "Neuigkeiten von Marken"
},
{
"answerUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"answerName": "Verkäufe und Angebote"
}
]
},
{
"topicName": "Häufigkeit",
"topicUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"topicAnswerUuids": [
{
"answerUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"answerName": "Monatlich"
}
]
}
],
"uuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"pending": false,
"createdAt": "2024-01-01T00:00:00",
"updatedAt": "2024-01-01T00:00:00",
"expiresAt": "2025-01-01T00:00:00"
}
]