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.

API Events #

All API actions, without exception, 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 an API request starts.

Naming Template #

The before event name is built using the following template:

<controller>:before<Action>

  • controller: API controller name
  • Action: controller action, camel cased

Example #

API actionAfter event name
auth:loginauth:beforeLogin
document:createOrReplacedocument:beforeCreateOrReplace

after #

ArgumentsTypeDescription
requestRequestThe normalized API request

An after event is triggered after an API request succeeds.

Naming Template #

The after event name is built using the following template:

<controller>:after<Action>

  • controller: API controller name
  • Action: controller action, camel cased

Example #

API actionAfter event name
auth:loginauth:afterLogin
document:createOrReplacedocument:afterCreateOrReplace

error #

ArgumentsTypeDescription
requestRequestThe normalized API request

An error event is triggered after an API request fails.

Naming Template #

The error event name is built using the following template:

<controller>:error<Action>

  • controller: API controller name
  • Action: controller action, camel cased

Example #

API actionAfter event name
auth:loginauth:errorLogin
document:createOrReplacedocument:errorCreateOrReplace