logo
logo

Create option list

POST /datasources

Body parameters

ParameterTypeDescription
nameStringCan only contain letters, numbers, dots or underscores. Because it is used as an identifier, this also needs to be unique.
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.
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.

Body examples

To obtain a result that looks like this:

send the following body:

{
    "name": "Groceries",
    "labels": {
        "en-US": "Groceries",
        "nl-BE": "Boodschappen"
    },
    "type": "Hierarchical",
    "values": [
        {
            "identifier" : "Bread",
            "labels": {
                "en-US": "Bread",
                "nl-BE": "Brood"
            },
            "values" : []
        },
        {
            "identifier" : "Spreads",
            "values" : [
                {
                    "identifier" : "Peanut butter",
                    "values" : []
                },
                {
                    "identifier" : "Jam",
                    "values" : []
                }
            ]
        },
    ],
    "is_system_owned": false
}

Response

ResponseBody
201 CreatedReturns an empty body when everything was processed without errors.
400 Bad RequestWill return an error message in the body accessible using the otherkey

Response examples

Status: 400 Bad Request

{
    "other": "Option list name can only contain letters, numbers, dots or underscores"
}

Can we improve this article ? Provide feedback