Creating a Schema Field

Scope: Schema
POST https://api.lucentcms.com/api/schemas/:key/fields

In order to create a new Field, the following headers are required:

Lucent-Channel: {channel-id}
Lucent-User: {sys-user-key}
Authentication: Bearer {sys-user-secret}
Accept-Language: en-US

The API expects the following data:

Field Type Description
id (unique) string (min:3, max:120, alphadash) An alphadash string. This is set on creation and cannot be changed later. It cannot be a System Reserved Id
name string (min:3, max:120) The name of the Field
type string The type of the Field (More info here). This is set on creation and cannot be changed later
status (optional) string (default:"active", "inactive") Whether the Field is active or not
ui (optional) string The UI that is used by the Lucent CMS (not relevant to developers)
help (optional) string (default:"") A help text for describing the Field
options Options Object An object containing all the Field Options. You must always pass an Options Object to the request, even if it's empty
validation Validation Object An object containing all the Field Validation options You must always pass a Validation Object to the request, even if it's empty

Below you can find a demo request and a demo response:

Demo Request

POST /api/schemas/taxons/fields

Lucent-Channel: {channel-id}
Lucent-User: {sys-user-key}
Authentication: Bearer {sys-user-secret}
Accept-Language: en-US
{
    "data": {
        "id": "website",
        "name": "Website",
        "type": "text",
        "options": {
            "options": "cddd57b7-0571-4a51-9bb3-34bfa22233ed",
            "localized": true,
            "repeatable": true
        },
        "validation": {
            "length": 5,
            "min": 4,
            "max": 10,
            "url": true
        }
    }
}

Demo Response

201 Created

{
    "data": {
        "id": "website",
        "name": "Website",
        "type": "text",
        "status": "active",
        "ui": "textarea",
        "help": "",
        "options": "options": "cddd57b7-0571-4a51-9bb3-34bfa22233ed", 
            "localized": true,
            "repeatable": true,
        "validation": "length": 5,
            "min": 4,
            "max": 10,
            "url": true,
    },
    "errors": null,
    "meta": null,
    "links": null,
    "included": null
}