A Preferences Library is a set of re-usable preferences. Each preference can be used several times in your Configuration Tree, allowing a more granular choice to be offered to the user for given purposes.
Create a preference
To add a preference in your Preferences Library, send a POST request on /preferences.
1
POST https://api.didomi.io/preferences?organization_id=YOUR_ORG_ID
2
3
{
4
"name":{
5
"en":"String"
6
},
7
"description":{
8
"en":"String"
9
},
10
11
/**
12
* single: users will be able to make only one choice for this preference
13
* multi: users will be able to make multiple choices for this preference
14
*/
15
"type":"single || multi",
16
"values":[
17
{
18
"name":{
19
"en":"String"
20
}
21
},
22
{
23
"name":{
24
"en":"String"
25
}
26
}
27
]
28
}
Copied!
Didomi does not support translations. Only en key will be accepted when creating or editing a new preference.
Get all preferences
To retrieve the list of all your preferences, send a GET request on /preferences.
1
GET https://api.didomi.io/preferences?organization_id=YOUR_ORG_ID
2
3
{
4
"total":0,
5
"limit":0,
6
"skip":0,
7
"data":[
8
{
9
"id":"string",
10
"created_at":"Date",
11
"updated_at":"Date",
12
"name":{
13
"en":"String"
14
},
15
"description":{
16
"en":"String"
17
},
18
"organization_id":"string",
19
"type":"single",
20
"values":[
21
{
22
"id":"string",
23
"created_at":"Date",
24
"updated_at":"Date",
25
"name":{
26
"en":"String"
27
},
28
"order":0
29
},
30
{
31
"id":"string",
32
"created_at":"Date",
33
"updated_at":"Date",
34
"name":{
35
"en":"String"
36
},
37
"order":1
38
}
39
]
40
}
41
]
42
}
Copied!
Get a preference
To retrieve a preference from your Preferences Library, send a GET request on /preferences/{id}.
1
GET https://api.didomi.io/preferences/{id}?organization_id=YOUR_ORG_ID
2
3
{
4
"id":"string",
5
"created_at":"Date",
6
"updated_at":"Date",
7
"name":"string",
8
"description":"string",
9
"organization_id":"string",
10
"type":"single",
11
"values":[
12
{
13
"id":"string",
14
"created_at":"Date",
15
"updated_at":"Date",
16
"name":{
17
"en":"String"
18
},
19
"order":0
20
}
21
]
22
}
Copied!
Edit a preference
To edit a preference in your Preferences Library, send a PATCH request on /preferences/{id}.