Core
Write Plugins v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

Plugin Events #

Plugins can add new controllers to the Kuzzle API.

These new controllers and actions behave exactly like native API actions. All calls to plugins API actions trigger two of these three events:

  • before the action starts
  • after it succeeds
  • after it fails

before #

ArgumentsTypeDescription
requestRequestThe normalized API request

A before event is triggered before a plugin API request starts.

Naming Template #

The before event name is built using the following template:

<plugin name>/<controller>:before<Action>

  • plugin name: the plugin's name defined in the manifest file
  • controller: API controller name
  • Action: controller action, camel cased

Example #

Plugin nameAPI controllerActionAfter event name
plugincontrolleractionplugin/controller:beforeAction

after #

ArgumentsTypeDescription
requestRequestThe normalized API request

An after event is triggered after a plugin API request succeeds.

Naming Template #

The after event name is built using the following template:

<plugin name>/<controller>:after<Action>

  • plugin name: the plugin's name defined in the manifest file
  • controller: API controller name
  • Action: controller action, camel cased

Example #

Plugin nameAPI controllerActionAfter event name
plugincontrolleractionplugin/controller:afterAction

error #

ArgumentsTypeDescription
requestRequestThe normalized API request

An error event is triggered after a plugin API request fails.

Naming Template #

The error event name is built using the following template:

<plugin name>/<controller>:error<Action>

  • plugin name: the plugin's name defined in the manifest file
  • controller: API controller name
  • Action: controller action, camel cased

Example #

Plugin nameAPI controllerActionAfter event name
plugincontrolleractionplugin/controller:errorAction