logo
logo

Update option list items

PUT /datasources/:optionListName

Replace these placeholders:

placeholderdescription
:optionListNamethe name of the option list that needs to be updated

Body parameters

ParameterTypeDescription
nameStringThe name of the option list that needs to be changed. This parameter is required, even though the value can not be changed.
labelsLabelsThe translation(s) of the canonical name.
typeStringFlat 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.
valuesArray.<DatasourceValue>The Option list items that belong to the option list.
is_system_ownedBooleanfalse 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

ResponseBody
204 No ContentReturns an empty body when everything was processed without errors.
400 Bad RequestWill 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."
}

Can we improve this article ? Provide feedback