User preferences

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

Short Upload

Use this method to submit individual user preference updates, such as when a user completes a preference questionnaire. 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. Each object must include the following keys:

  • preference_key: the identifier for the preference category
  • preference_values: the selected preference values
  • ui: 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"
    }
  ]
}

⚠️ Note: Payloads are limited to a maximum of 100 items.

Batch Upload

For bulk data imports or backfilling existing preferences, use the batch upload method. This requires uploading a JSONL file via a multipart/form-data request. Gzipped files are supported as well. Unlike the short upload, there is no limit on the number of preference items per batch.

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"}