Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Content Management API > Plugin

Update a plugin

Body parameters

typestringRequired

Must be exactly "plugin".

attributes.namestringOptional

The name of the plugin

Example:"5 stars"
attributes.descriptionnull, stringOptional

A description of the plugin

Example:"A better rating experience!"
attributes.urlstringOptional

The entry point URL of the plugin

Example:"https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.ts"
attributes.package_namestringOptional

Turns a private plugin into a Marketplace plugin, installing the specified package from the DatoCMS Marketplace. Only accepted for private, non-legacy plugins, and cannot be combined with other attributes (except enabled). Name, description, URL, version and permissions are replaced with the ones published in the Marketplace, while the existing parameters are preserved.

Example:"datocms-plugin-star-rating-editor"
attributes.parametersobjectOptional

Global plugin configuration. Plugins can persist whatever information they want in this object to reuse it later. Refer to the CMA for details about technical limits.

Example:{ devMode: true }
attributes.package_versionnull, stringOptional

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

Example:"0.0.4"
attributes.permissionsOptional

Permissions granted to this plugin

Type:Array<string>
attributes.enabledbooleanOptional

Whether the plugin is enabled or not. When disabled, the plugin behaves as if it didn't exist: fields using it as editor/addon fall back to the default editor, and any sidebar panel/page/config screen/asset source it registers does not render.

Returns

Returns a resource object of type plugin.

Examples

PUT https://site-api.datocms.com/plugins/:plugin_id HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "plugin",
"id": "RMAMRffBRlmBuDlQsIWZ0g",
"attributes": {}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/plugins/:plugin_id' \
-X PUT \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"plugin","id":"RMAMRffBRlmBuDlQsIWZ0g","attributes":{}}}'
await fetch("https://site-api.datocms.com/plugins/:plugin_id", {
method: "PUT",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "plugin", id: "RMAMRffBRlmBuDlQsIWZ0g", attributes: {} },
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "plugin",
"id": "RMAMRffBRlmBuDlQsIWZ0g",
"attributes": {
"name": "5 stars",
"description": "A better rating experience!",
"url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.ts",
"parameters": {
"devMode": true
},
"package_name": "datocms-plugin-star-rating-editor",
"package_version": "0.0.4",
"permissions": [
"currentUserAccessToken"
],
"enabled": true
},
"meta": {
"version": "2"
}
}
}