Show examples in:
    List all record versions

    Query parameters

    nested  string  Optional

    For Modular Content fields and Structured Text fields. If set, returns full payload for nested blocks instead of IDs

    page  object  Optional

    Attributes to manage results pagination

    Returns

    Returns an array of item_version resource objects.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const itemId = '6542';
    // this only returns the first page of results:
    const itemVersions = await client.itemVersions.list(itemId, {
    nested: 'true',
    page: {
    offset: 200,
    limit: 20
    }
    });
    itemVersions.forEach((itemVersion) => {
    console.log(itemVersion);
    });
    // this iterates over every page of results:
    for await (const itemVersion of client.itemVersions.listPagedIterator(
    itemId,
    {
    nested: 'true'
    }
    )) {
    console.log(itemVersion);
    }
    }
    run();
    Returned output:
    {
    id: '6542',
    title: 'My first blog post!',
    content: 'Lorem ipsum dolor sit amet...',
    category: '24',
    image: {
    alt: 'Alt text',
    title: 'Image title',
    custom_data: {},
    focal_point: null,
    upload_id: '20042921'
    },
    meta: {
    created_at: '2020-04-21T07:57:11.124Z',
    is_valid: true,
    is_published: true,
    is_current: true
    },
    item_type: {
    type: 'item_type',
    id: '44'
    },
    item: {
    type: 'item',
    id: '4235'
    },
    editor: {
    type: 'account',
    id: '312'
    }
    }