REST API and extension hooks

Integrate Free rule management and supported extension contracts.

Reviewed 2026-08-05

Authentication and permissions

Management routes use the namespace /wp-json/laqi-osa/v1 and require an authenticated WordPress user who can manage WooCommerce. Use normal WordPress REST authentication and nonce or application-password handling for the client involved.

Do not expose a privileged REST nonce or application password in public browser code.

Route groups

  • /rules and /rules/{id} list, create, read, update, and delete rules.
  • /rules/reorder, /rules/test, and /rules/{id}/apply manage priority and controlled testing or application.
  • /rules/export and /rules/import transfer validated rules.
  • /rules/explain returns the condition trace for an order and rule.
  • /settings and /log manage global Free settings and activity.
  • /meta and /search provide rule-builder field data and store-value search.

Inspect the WordPress REST index on the exact installed plugin version for supported methods and argument schemas before building an integration.

Lifecycle hooks

  • laqi_osa_rule_fired runs after all actions for a firing.
  • laqi_osa_should_apply_rule can veto a firing before actions run.
  • laqi_osa_before_action and laqi_osa_after_action wrap each individual action.

Use vetoes sparingly and keep callbacks fast. Slow network work should be queued rather than performed inside rule evaluation.

Add rule-building options

The plugin can be extended through:

  • laqi_osa_action_registry and laqi_osa_action_types for a custom action and its editor fields.
  • laqi_osa_fields for a condition field and order-value resolver.
  • laqi_osa_operators for a custom comparison operator.
  • laqi_osa_rule_templates for a starter template.

The trigger-registry and admin-extension contracts are versioned developer surfaces. Inspect the plugin’s bundled docs/trigger-registry-contract.md and docs/admin-extension-contract.md for the exact interface and lifecycle requirements of the installed version.

An extension must validate and sanitize its configuration, remain compatible with PHP 7.4 where required by the store, and use WooCommerce order APIs instead of direct database writes.

Still need help?

Tell us what you are trying to do and where you got stuck.

Contact support