Preferences Library

A preferences library is a set of re-usable preferences.

Each preference created in the preferences library can be used several times in the configuration tree allowing a more granular choice to be offered to the user for given purposes.

A collection of preferences facilitates analysis of user's choices made on your widgets.

Preferences

A Preference is an opportunity to collect information about user's intentions, motivations and interests.

Each preference has several choices (values) and can be added to one or multiple purpose(s) to offer a more granular choice to the user.

Preferences should match with different marketing use cases. Some examples:

  • Topic and content choices

  • Frequency options

  • Custom customer data questions

  • Privacy policies, programmes and certifications

  • Access to privacy rights information

Values

A value is a string and is always linked to a preference. When you create a preference, you create a list of values from where the user will be able to choose from.

You can see the preference as the question and the value as one of the answer to that question.

Create a preference

To add a preference in your Preferences Library, send a POST request on /preferences.

POST https://api.didomi.io/preferences?organization_id=YOUR_ORG_ID

{
  "name": {
    "en": "String",
    "fr": "String"
  },
  "description": {
    "en": "String",
    "fr": "String"
  },
  "metadata": {},
  /**
  * single: users will be able to make only one choice for this preference
  * multi: users will be able to make multiple choices for this preference  
  */
  "type": "single || multi",
  "values": [
    {
      "name": {
        "en": "String",
        "fr": "String"
      },
      "metadata": {},      
    },
    {
      "name": {
        "en": "String",
        "fr": "String"
      },
      "metadata": {},
    }    
  ]
}

Didomi supports translations. Add your translated content by using available keys detailed here.

Get all preferences

To retrieve the list of all your preferences, send a GET request on /preferences.

GET https://api.didomi.io/preferences?organization_id=YOUR_ORG_ID

{
  "total": 0,
  "limit": 0,
  "skip": 0,
  "data": [
    {
      "id": "string",
      "created_at": "Date",
      "updated_at": "Date",
      "name": {
        "en": "String",
        "fr": "String"
      },
      "description": {
        "en": "String",
        "fr": "String"
      },
      "metadata": {},      
      "organization_id": "string",
      "type": "single",
      "values": [
        {
          "id": "string",
          "created_at": "Date",
          "updated_at": "Date",
          "name": {
            "en": "String",
            "fr": "String"
          },
          "metadata": {},
          "order": 0
        },
        {
          "id": "string",
          "created_at": "Date",
          "updated_at": "Date",
          "name": {
            "en": "String",
            "fr": "String"
          },
          "metadata": {},          
          "order": 1
        }
      ]
    }
  ]
}

Get a preference

To retrieve a preference from your Preferences Library, send a GET request on /preferences/{id}.

GET https://api.didomi.io/preferences/{id}?organization_id=YOUR_ORG_ID

{
  "id": "string",
  "created_at": "Date",
  "updated_at": "Date",
  "name": {
    "en": "String",
    "fr": "String"
  },
  "description": {
    "en": "String",
    "fr": "String"
  },
  "metadata": {},  
  "organization_id": "string",
  "type": "single",
  "values": [
    {
      "id": "string",
      "created_at": "Date",
      "updated_at": "Date",
      "name": {
        "en": "String",
        "fr": "String"
      },
      "metadata": {},      
      "order": 0
    }
  ]
}

Edit a preference

To edit a preference in your Preferences Library, send a PATCH request on /preferences/{id}.

PATCH https://api.didomi.io/preferences/{id}?organization_id=YOUR_ORG_ID

{
  "name": {
    "en": "String",
    "fr": "String"
  },
  "description": {
    "en": "String",
    "fr": "String"
  },
  "metadata": {},
  "type": "single",
  "values": [
    {
      "id": "string",
      "name": {
        "en": "String",
        "fr": "String"
      },
      "metadata": {},
    }
  ]
}

Note that values order edition is not supported.

When you are editing a preference, all existing values in values array need to be included in your PATCH request so they are not deleted.

Delete a preference

To delete a preference from your Preferences Library, send a DELETE request on /preferences/{id}.

DELETE https://api.didomi.io/preferences/{id}?organization_id=YOUR_ORG_ID

Last updated