Show examples in:
    Retrieve all fields using the plugin

    Returns

    Returns an array of field resource objects.

    Examples

    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const pluginId = '124';
    const plugins = await client.plugins.fields(pluginId);
    plugins.forEach((plugin) => {
    console.log(plugin);
    });
    }
    run();
    Returned output:
    {
    id: '124',
    label: 'Title',
    field_type: 'string',
    localized: true,
    default_value: {
    en: 'A default value',
    it: 'Un valore di default'
    },
    api_key: 'title',
    hint: 'This field will be used as post title',
    validators: {
    required: {}
    },
    appearance: {
    editor: 'single_line',
    parameters: {
    heading: false
    },
    addons: [
    {
    id: '1234',
    field_extension: 'lorem_ipsum',
    parameters: {}
    }
    ]
    },
    position: 1,
    item_type: {
    type: 'item_type',
    id: '44'
    },
    fieldset: null
    }