Show examples in:
Update a field

Body Parameters

default_value  Optional  boolean, null, string, number, object  Example: {"en":"A default value","it":"Un valore di default"}

Default value for Field. When field is localized accepts an object of default values with site locales as keys

label  Optional  string  Example: "Title"

The label of the field

api_key  Optional  string  Example: "title"

Field API key

localized  Optional  boolean  Example: true

Whether the field needs to be multilanguage or not

validators  Optional  object  Example: {"required":{}}

Optional field validations

appearance  Optional  object  Example: {"editor":"single_line","parameters":{"heading":false},"addons":[{"id":"1234","field_extension":"lorem_ipsum","parameters":{}}]}

Field appearance details, plugin configuration and field add-ons

position  Optional  integer  Example: 1

Ordering index

field_type  Optional  enum  Example: "string"

Type of input

hint  Optional  string, null  Example: "This field will be used as post title"

Field hint

deep_filtering_enabled  Optional  boolean  Example: true

Whether deep filtering for block models is enabled in GraphQL or not

fieldset  Optional  null, { type: "fieldset", id: fieldset.id }

Fieldset linkage

Returns

Returns a field resource object.

Examples

Example Basic example
import { buildClient } from '@datocms/cma-client-node';
async function run() {
const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
const fieldIdOrApiKey = 'blog_post::title';
const field = await client.fields.update(fieldIdOrApiKey, {});
console.log(field);
}
run();