Show examples in:
    Create a new filter

    Body Parameters

    id  string  Optional
    RFC 4122 UUID of filter expressed in URL-safe base64 format
    name  Required  string  Example: "Draft posts"

    The name of the filter

    filter  Optional  object  Example: {"query":"foo bar","fields":{"_status":{"eq":"draft"},"title":{"matches":{"pattern":"qux","case_sensitive":"false","regexp":"false"}}}}

    The actual filter. It follows the form of the filter query parameter of the List all records endpoint.

    columns  Optional  Array<object>, null  Example: [{"name":"_preview","width":0.6},{"name":"slug","width":0.1},{"name":"_status","width":0.1},{"name":"_updated_at","width":0.2}]

    The columns to show with this filter

    order_by  Optional  string, null  Example: "_updated_at_ASC"

    The ordering to apply with this filter, or null for the default model ordering. It follows the form of the order_by query parameter of the List all records endpoint.

    shared  Optional  boolean  Example: true

    Whether it's a shared filter or not

    item_type  Required  { type: "item_type", id: item_type.id }

    Model associated with the filter

    Returns

    Returns a item_type_filter resource object.

    Examples

    Example Basic example
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const itemTypeFilter = await client.itemTypeFilters.create({
    name: 'Draft posts',
    item_type: {
    type: 'item_type',
    id: 'DxMaW10UQiCmZcuuA-IkkA'
    }
    });
    console.log(itemTypeFilter);
    }
    run();