Core
Framework v2.x
2

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
request
KuzzleRequest
The 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 actionBefore event name
auth:loginauth:beforeLogin`
document:createOrReplacedocument:beforeCreateOrReplace

after #

ArgumentsTypeDescription
request
KuzzleRequest
The 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
request
KuzzleRequest
The 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