Choose your language:
    Retrieve all fields using the plugin
    Returns
    Returns an array of field objects.

    Examples

    Example code:
    const { SiteClient } = require('datocms-client');
    async function run() {
    const client = new SiteClient('YOUR-API-TOKEN');
    const pluginId = '124';
    const plugins = await client.plugin.fields(pluginId);
    plugins.forEach((plugin) => {
    console.log(plugin);
    });
    }
    run();
    Returned output:
    > node example.js
    {
    "id": "124",
    "label": "Title",
    "fieldType": "string",
    "localized": true,
    "defaultValue": {
    "en": "A default value",
    "it": "Un valore di default"
    },
    "apiKey": "title",
    "hint": "This field will be used as post title",
    "validators": {
    "required": {}
    },
    "appearance": {
    "editor": "single_line",
    "parameters": {
    "heading": false
    },
    "addons": [
    {
    "id": "1234",
    "fieldExtension": "lorem_ipsum",
    "parameters": {}
    }
    ]
    },
    "position": 1,
    "itemType": "44",
    "fieldset": null
    }