Types of Actions
There are two types of actions: HTTP actions and Embedded actions.
These actions act on the HTTP request-response protocol associated with an API endpoint. That is, they occur before and after an API operation executes, and you can use them to modify the request or response associated with the operation.
You can identify an HTTP action by the 'http' prefix.
|HTTP Action Occurrence||Request||Response|
These actions can read and write the incoming HTTP request.
These actions can shortcut the Kibo eCommerce response and provide their own response or add response headers that persist through the Kibo eCommerce operation. They cannot read the response because it is blank at this stage of the process.
These actions can read the request but cannot modify it.
These actions can read and write the response generated by Kibo eCommerce.
The following example read/writes the HTTP response after the ChangePassword API operation runs:
http.commerce.customer.accounts.changePassword.afterNote: HTTP actions also include storefront HTTP actions, which don't correspond to an API operation, but instead run before or after a shopper requests a specific page on your storefront, such as the checkout page, the My Account page, a CMS page, etc.
These actions retrieve information about and respond to Kibo eCommerce microservice operations. They might, for example, provide you access to the microservice that manages orders, or the microservice that manages carts. In addition to providing read access to the microservice object, these actions provide special exec methods that allow you to manipulate the microservice object in predetermined ways. The exact methods provided vary depending on the type of action and the Kibo eCommerce object in question. In general, embedded actions with a before occurrence run when the request for the microservice is made, and can persist changes to Kibo eCommerce. Actions with an after occurrence run after the microservice operation completes, and cannot persist changes to Kibo eCommerce (but are suitable for monitoring or and other information-gathering tasks).
You can identify an embedded action by the 'embedded' prefix.
The following example runs when a request to add an item to a cart is made: