Get preferences for the current user
Get preferences for the current user¶
If you want to use the current user’s preferences, there are two endpoints that are responsible for retrieving preferences and posting new or updating existing preference data objects using the access token of specific user.
To retrieve all the preferences for the current user you can send a GET
request to the designated endpoint /preferences/my
, which can also accept optional parameter of widgetID if you want to retrieve preferences only from a specific widget. To authenticate with this endpoint you need to use the JWT token you generated for this user.
Parameters: - widgetUuid
(optional): Widget UUID for which to return preferences. If not defined, preference data from all widgets under a specific Configuration ID, for which the JWT token was generated, will be returned.
The response will contain set of preference objects with the following data:
uuid
- ID of a specific preference data objectwidgetId
- ID of the Widget this object was submitted underpending
- Boolean flag, if these preferences are in 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 wheretopicUuid
refers to the Topic ID under the set of options (topicAnswersUuid
) that are selected
Example:
[
{
"uuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"widgetId": "1234abcd-22bb-33cc-44dd-12345678abcd",
"pending": false,
"answers": [
{
"topicUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"topicAnswerUuids": [
"1234abcd-22bb-33cc-44dd-12345678abcd",
"1234abcd-22bb-33cc-44dd-12345678abcd"
]
},
{
..............
}
],
"createdAt": "2024-01-01T00:00:00",
"updatedAt": "2024-01-01T00:00:00",
"expiresAt": "2024-01-01T00:00:00"
}
]
Response
[
{
"uuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"widgetId": "1234abcd-22bb-33cc-44dd-12345678abcd",
"pending": false,
"answers": [
{
"topicUuid": "1234abcd-22bb-33cc-44dd-12345678abcd",
"topicAnswerUuids": [
"1234abcd-22bb-33cc-44dd-12345678abcd",
"1234abcd-22bb-33cc-44dd-12345678abcd"
]
},
{
..............
}
],
"createdAt": "2024-01-01T00:00:00",
"updatedAt": "2024-01-01T00:00:00",
"expiresAt": "2024-01-01T00:00:00"
}
]