You're reading "Content Management API"

Plugin

Plugins enable developers to replace DatoCMS field components with HTML5 applications so the editing experiences of the DatoCMS web app can be customized.

The Plugin object

A Plugin object is returned as part of the response body of each successful Index, Show, Create, Update or Delete API call. The following table contains the list of all its fields along with their type, description and example values.

Object fields:
descriptionstring

A textual description for the plugin

field_typesarray

On which types of field this plugin can be used

This attribute is required
namestring

The name of the plugin

This attribute is required
package_namestring

Plugin Npm package name

package_versionstring

Plugin Npm version

parameter_definitionsobject

Parameter definitions for the plugin

This attribute is required
parametersobject

Global parameters which are set on on a project level. Values apply globally to every instance of an plugin within the project.

This attribute is required
plugin_typestring

The type of extension

This attribute is required
urlstring

The name of the plugin

This attribute is required

List all plugins

To list all plugins, send a GET request to the /plugins endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
GET https://site-api.datocms.com/plugins HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": [ { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4", "plugin_type": "field", "field_types": [ "integer", "float" ], "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] } } } ] }

Retrieve a plugins

To retrieve a plugins, send a GET request to the /plugins/:plugin_id endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
GET https://site-api.datocms.com/plugins/:plugin_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4", "plugin_type": "field", "field_types": [ "integer", "float" ], "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] } } } }

Create a new plugin

To create a new plugin, send a POST request to the /plugins endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
POST https://site-api.datocms.com/plugins HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "plugin", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "field_types": [ "integer", "float" ], "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] }, "plugin_type": "field", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4" } } }
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4", "plugin_type": "field", "field_types": [ "integer", "float" ], "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] } } } }

Update an plugin

To update an plugin, send a PUT request to the /plugins/:plugin_id endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
PUT https://site-api.datocms.com/plugins/:plugin_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "package_version": "0.0.4" } } }
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4", "plugin_type": "field", "field_types": [ "integer", "float" ], "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] } } } }

Delete an plugin

To delete an plugin, send a DELETE request to the /plugins/:plugin_id endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
DELETE https://site-api.datocms.com/plugins/:plugin_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "plugin", "id": "124", "attributes": { "name": "5 stars", "description": "A simple field editor that allows a nicer editing rating experience", "package_name": "datocms-plugin-star-rating-editor", "package_version": "0.0.4", "plugin_type": "field", "field_types": [ "integer", "float" ], "url": "https://cdn.rawgit.com/datocms/extensions/master/samples/five-stars/extension.js", "parameters": { "devMode": true }, "parameter_definitions": { "global": [ { "id": "devMode", "type": "boolean", "label": "Run in development mode" } ], "instance": [ { "id": "halfStars", "type": "boolean", "label": "Allow half stars ratings?", "default": false, "hint": "If enabled, rate using whole stars, if enabled, it doesn't use half-steps" }, { "id": "totalStars", "type": "integer", "label": "Amount of stars to show", "default": 5, "hint": "" } ] } } } }