Show examples in:
    Update a plugin

    Body Parameters

    name  Optional  string  Example: "5 stars"

    The name of the plugin

    description  Optional  null, string  Example: "A better rating experience!"

    A description of the plugin

    url  Optional  string  Example: "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js"

    The entry point URL of the plugin

    parameters  Optional  object  Example: {"devMode":true}

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

    package_version  Optional  null, string  Example: "0.0.4"

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

    permissions  Optional  Array<string>

    Permissions granted to this plugin

    Returns

    Returns a plugin resource object.

    Examples

    Example Update of plugin global parameters (both private and public)
    import { buildClient } from "@datocms/cma-client-node";
    async function run() {
    // Make sure the API token has access to the CMA, and is stored securely
    const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
    const pluginId = "124";
    const plugin = await client.plugin.update(pluginId, {
    parameters: { foo: "bar" },
    });
    console.log(plugin);
    }
    run();
    Example Upgrade of a public plugin
    import { buildClient } from "@datocms/cma-client-node";
    async function run() {
    // Make sure the API token has access to the CMA, and is stored securely
    const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
    const pluginId = "124";
    const plugin = await client.plugin.update(pluginId, {
    package_version: "2.0.0",
    });
    console.log(plugin);
    }
    run();
    Example Update of private plugin configuration
    import { buildClient } from "@datocms/cma-client-node";
    async function run() {
    // Make sure the API token has access to the CMA, and is stored securely
    const client = buildClient({ apiToken: process.env.DATOCMS_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();