Home
Content Management API⁡𝅶‍‍𝅺⁡‍𝅴⁡𝅴𝅹‍‍⁢𝅵‍‍⁣⁣‌⁡⁣𝅺⁣⁢⁣𝅸⁠⁢‍‍‍𝅷‍‍𝅳⁡‍⁠‍‍⁢𝅵‍‍𝅳⁡⁣⁡⁣⁡​⁡⁢⁢𝅵‍𝅺‍𝅺⁢𝅸⁡⁢‍𝅹⁣‌⁡⁣𝅺⁢𝅸⁡⁢‍𝅹⁢𝅺𝅸‍𝅺⁠⁣𝅴⁡⁣𝅺⁡‍‍𝅺𝅴⁡⁣⁠𝅸⁠𝅺⁡⁣⁡𝅴⁡​⁠⁡⁢‍𝅺⁢𝅳⁢‌⁢​⁢𝅴⁢‍⁢⁠‍𝅺𝅴⁡⁣⁠𝅸⁡⁢‍𝅺⁢⁢⁢𝅴⁢𝅳⁢⁢⁢‌⁢⁡⁢𝅳⁢‌‍‍⁡𝅸
Main resources
Upload-related
Site Search
Environments
UI
Workflows
Async jobs
Roles & permissions
Webhooks
Hosting & CI integrations
Subscription
Enterprise
    Show examples in:
    Update a plugin

    Parameters

    name  string  Optional

    The name of the plugin

    description  null, string  Optional

    A description of the plugin

    url  string  Optional

    The entry point URL of the plugin

    parameters  object  Optional

    Global plugin configuration. Plugins can persist whatever information they want in this object to reuse it later.

    package_version  null, string  Optional

    The installed version of the plugin (or null if it's a private plugin)

    permissions  Array<string>  Optional

    Permissions granted to this plugin

    Returns

    Returns a plugin resource object.

    Examples

    The following examples are available:

    Update of plugin global parameters (both private and public)
    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const pluginId = '124';
    const plugin = await client.plugin.update(pluginId, {
    parameters: { foo: 'bar' },
    });
    console.log(plugin);
    }
    run();
    Returned output:
    const result = {
    type: 'plugin',
    id: '124',
    name: '5 stars',
    /* ... */
    parameters: { foo: 'bar' },
    };
    Upgrade of a public plugin
    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const pluginId = '124';
    const plugin = await client.plugin.update(pluginId, {
    package_version: '2.0.0',
    });
    console.log(plugin);
    }
    run();
    Returned output:
    const result = {
    type: 'plugin',
    id: '124',
    name: '5 stars',
    /* ... */
    package_version: '2.0.0',
    };
    Update of private plugin configuration
    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const plugin = await client.plugins.update({
    name: '5 stars',
    description: 'A better rating experience!',
    url: 'https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js',
    permissions: ['currentUserAccessToken'],
    });
    console.log(plugin);
    }
    run();
    Returned output:
    const result = {
    type: 'plugin',
    id: '124',
    name: '5 stars',
    description: 'A better rating experience!',
    package_name: null,
    package_version: null,
    url: 'https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js',
    permissions: ['currentUserAccessToken'],
    parameters: { foo: 'bar' },
    };