How To: Extend Entities to Reflect Changes in the API¶
Here are some simple rules to follow if your third-party add-on adds, removes, or changes any data of an entity, and you need those changes to be received in the API.
- Perform all data processing only with the help of hooks. For example, your add-on adds a new
closed_date
field to the order entity. Here this new field must be processed in thefn_get_order_info
function hook. - Do not use
pre
andpost
controllers for data processing. - Do not wrap a code block with data processing in the API to the condition:
if (!defined('API')) {
// Some code
}
- Do not add data in the
processor_params
array for the payment systems entity, as this is private data and it is removed at the API level.
If a third-party add-on adds, removes, or changes any data in email notifications, this does not affect the data set in the API response.