Show examples in:
Update a model

Body Parameters

name  Optional  string  Example: "Blog post"

Name of the model

api_key  Optional  string  Example: "post"

API key of the model

collection_appearance  Optional  enum  Example: "compact"

The way the model collection should be presented to the editors

singleton  Optional  boolean

Whether the model is single-instance or not

all_locales_required  Optional  boolean

Whether we require all the project locales to be present for each localized field or not

sortable  Optional  boolean  Example: true

Whether editors can sort records via drag & drop or not

modular_block  Optional  boolean

Whether this model is a modular content block or not

draft_mode_active  Optional  boolean

Whether draft/published mode is active or not

tree  Optional  boolean

Whether editors can organize records in a tree or not

ordering_direction  Optional  enum, null

If an ordering field is set, this fields specify the sorting direction

ordering_meta  Optional  enum, null  Example: "created_at"

Specifies the model's sorting method. Cannot be set in concurrency with ordering_field

hint  Optional  string, null  Example: "Blog posts will be shown in our website under the Blog section"

A hint shown to editors to help them understand the purpose of this model/block

inverse_relationships_enabled  Optional  boolean

Whether inverse relationships fields are expressed in GraphQL or not

meta.has_singleton_item  Optional  boolean

If this model is single-instance, this tells the single-instance record has already been created or not

ordering_field  Optional  { type: "field", id: field.id }, null

The field upon which the collection is sorted

title_field  Optional  { type: "field", id: field.id }, null

The field to use as display title

image_preview_field  Optional  { type: "field", id: field.id }, null

The field to use as preview image

excerpt_field  Optional  { type: "field", id: field.id }, null

The field to use as fallback description for SEO purposes

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

The workflow to enforce on records

Returns

Returns a item_type resource object.

Examples

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