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 itsvaluestring to rename it (the new label propagates into existing content); - a value without an
id→ a new value is appended; - an existing value whose
idis absent from the list → it is removed, and cleared from every content using it.
Endpoint
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
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The 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 Size → TshirtSize, rename value S → Small (keeping its id), add XL, and drop L by omitting it:
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
| Code | Description |
|---|---|
| 200 | The enum was updated. The response body contains the enum id. |
| 400 | Invalid payload — bad name, empty values, or duplicate values. |
| 401 | Unauthorized. The token is missing, malformed or expired. |
| 403 | Forbidden. The token does not have write permissions — use a Write Token. |
| 404 | No enum with the given :id exists in the project. |
| 500 | Internal server error. |