Create Enum
Creates a new Enum model: a closed, named list of string values that entity fields of type enum can reference. The server assigns an id to the enum and to each value.
Endpoint
curl -X POST https://api.contentisland.net/api/1.0/model/enum \--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \--header 'Content-Type: application/json' \--data '{ ... }'Body
interface CreateEnumPayload { name: string; // enum name (same rules as a model name) values: EnumValueSpec[]; // at least one value, in order}
interface EnumValueSpec { id?: string; // omit when creating — the server assigns one value: string; // the value label}| Name | Description |
|---|---|
name | The enum name. Same name rules as a model name, unique across the project’s models. |
values | The enum values, in order. At least one value is required. Values must be unique within the enum (case-insensitive). |
Example
curl -X POST https://api.contentisland.net/api/1.0/model/enum \--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \--header 'Content-Type: application/json' \--data '{ "name": "Size", "values": [ { "value": "S" }, { "value": "M" }, { "value": "L" } ]}'Response
On success the endpoint returns 201 Created with the id of the new enum:
{ "id": "660f5b8a3a1c2d4e7f8b34cd"}Status Codes
| Code | Description |
|---|---|
| 201 | The enum was created. The response body contains the new enum id. |
| 400 | Invalid payload — bad name (format / length / reserved / duplicate), 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. |
| 500 | Internal server error. |