Update the preferences for the current user
Update the preferences for the current user¶
To post new or update existing preferences for the user, you can use the same endpoint /preferences
using the POST method.
Parameters:
The endpoint uses the following parameters: - pacUuid
(required): The ID of the configuration that contains the widget for which the preference data needs to be added/updated. - x-user-id
(required): The ID of the user preference for which the object is being added. - x-user-email
(optional): The email of the user to be used in a transactional emails in case UserID is not email (i.e. in case of Double-opt-In). - behalf
(optional): If true
, preference is saved on behalf of the user, so in the audit log the author of the change will be displayed as userID. If false
(default)- the author of the change will remain the owner of the API Key with which the request is authorized.
Request body
Similar to the /preferences/my
endpoint, this one will accept the payload containing a new preference object in JSON format, containing Topics and the selected options ID that needs to be posted/updated. Only those, specified in the request body will be updated.
{
"widgetUuid": "string",
"language": "string",
"answers": [
{
"topicUuid": "string",
"topicAnswerUuids": [
"string"
]
}
]
}
widgetUuid
) and language code (language
) to properly submit a valid request. Example:
Preference data submission request:
curl -X 'POST' \
'https://preference-api.preference-management.usercentrics.eu/public/preferences/my' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUz.......H5AC9Ru41TKgM' \
-H 'Content-Type: application/json' \
-d '{
"widgetUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"language": "en",
"answers": [
{
"topicUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"topicAnswerUuids": [
"1234abcd-22bb-33cc-44dd-12345678abcd",
"1234abcd-22bb-33cc-44dd-12345678abcd"
]
}
]
}'