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

    Examples

    Example code:
    const SiteClient = require('datocms-client').SiteClient;
    const client = new SiteClient('YOUR-API-TOKEN');
    const pluginId = '124';
    client.plugin.fields(pluginId)
    .then((plugins) => {
    plugins.forEach((plugin) => {
    console.log(plugin);
    });
    })
    .catch((error) => {
    console.error(error);
    });
    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
    }