Returns a resource object of type item_type
1import { buildClient } from "@datocms/cma-client-node";2 3async function run() {4 const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });5 6 const modelIdOrApiKey = "blog_post";7 8 const itemType = await client.itemTypes.find(modelIdOrApiKey);9 10 // Check the 'Returned output' tab for the result ☝️11 console.log(itemType);12}13 14run();
1{2 id: "DxMaW10UQiCmZcuuA-IkkA",3 name: "Blog post",4 api_key: "post",5 singleton: false,6 sortable: true,7 modular_block: false,8 tree: false,9 ordering_direction: null,10 ordering_meta: "created_at",11 draft_mode_active: false,12 all_locales_required: false,13 collection_appearance: "compact",14 hint: "Blog posts will be shown in our website under the Blog section",15 inverse_relationships_enabled: false,16 meta: { has_singleton_item: false },17 singleton_item: null,18 fields: [{ type: "field", id: "Pkg-oztERp6o-Rj76nYKJg" }],19 fieldsets: [{ type: "fieldset", id: "93Y1C2sySkG4Eg0atBRIwg" }],20 title_field: null,21 image_preview_field: null,22 excerpt_field: null,23 ordering_field: null,24 workflow: null,25}