Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Model/Block

Duplicate model

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.duplicate(modelIdOrApiKey);
// 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,
}