method = WP_REST_Server::READABLE; $this->route = '/automation/event-rules/(?P[a-zA-Z0-9_]+)'; } public function process_api_call() { $event = $this->get_sanitized_arg( 'event' ); if ( empty( $event ) ) { return $this->error_response_200( __( 'Invalid or empty event', 'wp-marketing-automations' ), null, 400 ); } $aid = $this->get_sanitized_arg( 'automation_id' ); BWFAN_Core()->rules->load_rules_classes(); $rules = BWFAN_Core()->rules->get_rules( $event, absint( $aid ) ); return $this->success_response( $rules ); } } BWFAN_API_Loader::register( 'BWFAN_API_Get_Rules' );