---
title: "Update option list items"
slug: "update-option-list-items"
abstract: ""
---
# Update option list items

```text
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** | [`Labels`](https://doc.sitecore.com/ch/en/developers/cloud-dev/labels.html) | 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. [`DatasourceValue`](https://doc.sitecore.com/ch/en/developers/cloud-dev/datasourcevalue--option-list-value-.html) | The [Option list items](https://doc.sitecore.com/ch/en/developers/cloud-dev/datasourcevalue--option-list-value-.html) 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](https://doc.sitecore.com/ch/en/developers/cloud-dev/create-an-option-list.html "Create an option list")

![Example of option list](https://doc.sitecore.com/api/markdown-image/ch/en/developers/cloud-dev/images/example_of_option_list.png)

And it is to be converted to:

![Example of updated option list](https://doc.sitecore.com/api/markdown-image/ch/en/developers/cloud-dev/images/example_of_updated_option_list.png)

Pass the following body to the resource:

```csharp
{
  "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

```csharp
Status: 400 Bad Request

{
  "Message": "The type of an existing datasource cannot be changed."
}

```