Update option list items
PUT /datasources/{name}
Replace these placeholders:
placeholder |
description |
---|---|
{name} |
the name of the option list that needs to be updated |
Body parameters
Parameter |
Type |
Description |
---|---|---|
name |
String |
The name of the option list that needs to be changed. This parameter is required, even though the value can not be changed. |
labels |
The translation(s) of the canonical name. | |
type |
String |
Flat disables nesting of option list items, Hierarchical enables nesting option list items. If it set to Flat and the values array contains nested items, it will throw an error. This parameter is required, even if it remains unaltered. |
values |
Array. |
The Option list items that belong to the option list. |
is_system_owned |
Boolean |
false allows the option list to be editable, true locks the option list preventing any further modifications. When creating an option list using the API, you should always use false, which is the default value. |
This resource works by overwriting the entire values array of the option list with the one that is being sent in the PUT request body.
To delete an option list item, send the entire existing values array of the option list again, minus the option item that needs to be deleted.
To rename an item, send the entire values array minus the option item needs to be renamed plus an option item containing the new name.
It is not possible to change the name of the option list at the moment.
Body examples
Take the configuration from the create option list example
And it is to be converted to:
Pass the following body to the resource:
{
"name": "Groceries",
"type": "Hierarchical",
"values": [
{
"identifier" : "Aloafofbread",
"labels": {
"en-US": "A loaf of bread",
"nl-BE": "Een brood"
},
"values" : []
},
{
"identifier" : "Jam",
"values" : []
}
]
}
Note that the name and the type parameters are mandatory, even if they can not be changed or do not change. The identifier string can only contain letters, numbers, underscores, hyphens, periods and shorter than 50 characters.
Response
Response |
Body |
---|---|
204 No Content |
Returns an empty body when everything was processed without errors. |
400 Bad Request |
Will return an error message in the body accessible using the other key, ie. when one of the required body parameters is missing |
Response examples
Status: 400 Bad Request
{
"Message": "The type of an existing datasource cannot be changed."
}