Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Model/Block

Update a model

Body parameters

name string Optional

Name of the model

Example: "Blog post"
api_key string Optional

API key of the model

Example: "post"
collection_appearance enum Optional

The way the model collection should be presented to the editors

Example: "compact"
compact Optional

Compact view

table Optional

Tabular view

singleton boolean Optional

Whether the model is single-instance or not

all_locales_required boolean Optional

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

sortable boolean Optional

Whether editors can sort records via drag & drop or not

modular_block boolean Optional

Whether this model is a modular content block or not

draft_mode_active boolean Optional

Whether draft/published mode is active or not

draft_saving_active boolean Optional

Whether draft records can be saved without satisfying the validations or not

tree boolean Optional

Whether editors can organize records in a tree or not

ordering_direction enum, null Optional

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

asc Optional

Ascending order

desc Optional

Descending order

ordering_meta enum, null Optional

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

Example: "created_at"
created_at Optional

Order by date of creation

updated_at Optional

Order by date of last update

first_published_at Optional

Order by date of first publication

published_at Optional

Order by date of last publication

hint string, null Optional

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

Example: "Blog posts will be shown in our website under the Blog section"
inverse_relationships_enabled boolean Optional

Whether inverse relationships fields are expressed in GraphQL or not

meta.has_singleton_item boolean Optional

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

ordering_field Optional

The field upon which the collection is sorted

title_field Optional

The field to use as display title

image_preview_field Optional

The field to use as preview image

excerpt_field Optional

The field to use as fallback description for SEO purposes

workflow Optional

The workflow to enforce on records

collection_appeareance enum Deprecated

The way the model collection should be presented to the editors

This field contains a typo and will be removed in future versions: use collection_appearance instead

Example: "compact"
compact Optional

Compact view

table Optional

Tabular view

Returns

Returns a resource object of type item_type

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const modelIdOrApiKey = "blog_post";
const itemType = await client.itemTypes.update(modelIdOrApiKey, {
id: "DxMaW10UQiCmZcuuA-IkkA",
});
// Check the 'Returned output' tab for the result ☝️
console.log(itemType);
}
run();
{
id: "DxMaW10UQiCmZcuuA-IkkA",
name: "Blog post",
api_key: "post",
singleton: false,
sortable: true,
modular_block: false,
tree: false,
ordering_direction: null,
ordering_meta: "created_at",
draft_mode_active: false,
all_locales_required: false,
collection_appearance: "compact",
hint: "Blog posts will be shown in our website under the Blog section",
inverse_relationships_enabled: false,
draft_saving_active: false,
meta: { has_singleton_item: false },
singleton_item: null,
fields: [{ type: "field", id: "Pkg-oztERp6o-Rj76nYKJg" }],
fieldsets: [{ type: "fieldset", id: "93Y1C2sySkG4Eg0atBRIwg" }],
title_field: null,
image_preview_field: null,
excerpt_field: null,
ordering_field: null,
workflow: null,
}