The user profile API allows clients to submit user preference data, which Constructor can utilize to conduct experiments and deliver a richer, more personalized user experience. The endpoint supports two content types: application/json
and multipart/form-data
. The Content-Type
header must be set accordingly. Additionally, every request requires a mandatory key
query parameter, specifying the index key to be used.
API endpoints
JSON upload
To submit smaller sets of user preference updates, such as when a user completes a preference questionnaire, JSON may be used. Requests must have the Content-Type
header set to application/json
. The request body should include a single user_preferences
key containing a list of preference objects.
preference_key
: the identifier for the preference categorypreference_values
: the selected preference valuesui
: the customer user id
Example request body
{
"user_preferences": [
{
"preference_key": "fit",
"preference_values": ["slim", "regular"],
"ui": "101"
},
{
"preference_key": "fit",
"preference_values": ["loose"],
"ui": "201"
}
]
}
Payloads are limited to a maximum of 100 items.
File upload
For bulk data imports or to backfill existing preferences for all users, file based uploads may be used. This requires uploading a JSONL file via a multipart/form-data
request. Files compressed via gzip are supported as well.
Each line in the JSONL file must represent a single preference object in the same format as the short upload:
{"preference_key": "fit", "preference_values": ["slim", "regular"], "ui": "101"}
{"preference_key": "fit", "preference_values": ["loose"], "ui": "201"}
Unlike JSON upload, there is no limit on the number of preference items per request.