Skip to content

Update Enum

Updates an existing Enum model: its name and the full set of values. As with PUT /model/entity, the body describes the desired final state and the server reconciles it against the current enum by value id.

How the reconciliation works

The values you send replace the enum’s value list, matched by id:

  • a value with an existing id → kept; change its value string to rename it (the new label propagates into existing content);
  • a value without an id → a new value is appended;
  • an existing value whose id is absent from the list → it is removed, and cleared from every content using it.

Endpoint

shell
curl -X PUT https://api.contentisland.net/api/1.0/model/enum/:id \
--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ ... }'

Path Parameters

NameTypeRequiredDescription
idstringyesThe 24-character id of the enum to update.

Body

interface UpdateEnumPayload {
name: string; // enum name (may rename the enum)
values: EnumValueSpec[]; // the complete desired value list, matched by id
}
interface EnumValueSpec {
id?: string; // include to preserve/rename an existing value; omit to add a new one
value: string;
}

Example

Rename SizeTshirtSize, rename value SSmall (keeping its id), add XL, and drop L by omitting it:

shell
curl -X PUT https://api.contentisland.net/api/1.0/model/enum/660f5b8a3a1c2d4e7f8b34cd \
--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"name": "TshirtSize",
"values": [
{ "id": "880b7d0c5c3e4f6a9b0d1234", "value": "Small" },
{ "id": "880b7d0c5c3e4f6a9b0d5678", "value": "M" },
{ "value": "XL" }
]
}'

Response

On success the endpoint returns 200 OK with the enum id:

{
"id": "660f5b8a3a1c2d4e7f8b34cd"
}

Status Codes

CodeDescription
200The enum was updated. The response body contains the enum id.
400Invalid payload — bad name, empty values, or duplicate values.
401Unauthorized. The token is missing, malformed or expired.
403Forbidden. The token does not have write permissions — use a Write Token.
404No enum with the given :id exists in the project.
500Internal server error.