Show examples in:
    Retrieve a model

    Returns

    Returns a item_type resource object.

    Examples

    Example code:
    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.find(modelIdOrApiKey);
    console.log(itemType);
    }
    run();
    Returned output:
    {
    id: '44',
    name: 'Blog post',
    api_key: 'post',
    collection_appearance: 'compact',
    singleton: false,
    all_locales_required: false,
    sortable: true,
    modular_block: false,
    draft_mode_active: false,
    tree: false,
    ordering_direction: null,
    ordering_meta: 'created_at',
    hint: 'Blog posts will be shown in our website under the Blog section',
    inverse_relationships_enabled: false,
    meta: {
    has_singleton_item: false
    },
    singleton_item: null,
    fields: [
    {
    type: 'field',
    id: '124'
    }
    ],
    fieldsets: [
    {
    type: 'fieldset',
    id: '124'
    }
    ],
    title_field: null,
    image_preview_field: null,
    excerpt_field: null,
    ordering_field: null,
    workflow: null
    }