The Pro API extends core functionality with advanced debugging capabilities and Pro-specific features.
Base URL: /wp-json/odcm-pro/v1/
Authentication: All Pro endpoints require:
- WordPress REST API authentication (cookies, application passwords, or JWT)
manage_woocommercecapability
Headers:
Content-Type: application/jsonfor POST/PUT requestsX-WP-Nonce: {nonce}for authenticated browser requests
Debug rule API
Comprehensive testing and debugging capabilities for automation rules.
GET /debug-rule/search-orders
Search for orders to use in rule testing.
Parameters:
search(string, optional) – order ID, customer name, or emaillimit(int, optional) – max results (default: 20, max: 50)
curl "https://yoursite.com/wp-json/odcm-pro/v1/debug-rule/search-orders?search=12345&limit=10"
-u "your-username:xxxx xxxx xxxx xxxx xxxx xxxx"Response:
{
"success": true,
"data": [
{
"id": 12345,
"status": "processing",
"total": "99.99",
"total_formatted": "<span class="woocommerce-Price-amount">$99.99</span>",
"currency": "USD",
"customer": "John Doe",
"date": "Jan 15, 2026",
"date_full": "2026-01-15 14:30:00"
}
]
}POST /debug-rule/test
Test a rule against a specific order with detailed analysis.
Request body:
{
"order_id": 12345,
"rule_data": {
"trigger": { "id": "order_processing", "settings": {} },
"conditions": [
{ "id": "product_type", "settings": { "types": ["virtual"], "match_all": false } }
],
"primaryAction": { "id": "change_status_to_completed", "settings": {} },
"secondaryActions": []
}
}curl -X POST "https://yoursite.com/wp-json/odcm-pro/v1/debug-rule/test"
-H "Content-Type: application/json"
-u "your-username:xxxx xxxx xxxx xxxx xxxx xxxx"
-d '{"order_id": 12345, "rule_data": {...}}'Response:
{
"success": true,
"data": {
"matched": true,
"conditions": [
{ "id": "product_type", "label": "Product Type", "result": "pass" }
],
"suggestions": ["This rule matched successfully!"],
"order_details": {
"id": 12345,
"status": "processing",
"total": "99.99",
"currency": "USD",
"payment_method": "stripe",
"customer_id": 456,
"date_created": "2026-01-15 14:30:00"
}
}
}Integration examples
JavaScript – test a rule:
const searchOrders = async (searchTerm, limit = 20) => {
const response = await fetch(
`/wp-json/odcm-pro/v1/debug-rule/search-orders?search=${encodeURIComponent(searchTerm)}&limit=${limit}`,
{ headers: { 'X-WP-Nonce': wpApiSettings.nonce } }
);
return response.json();
};
const testRule = async (orderId, ruleData) => {
const response = await fetch('/wp-json/odcm-pro/v1/debug-rule/test', {
method: 'POST',
headers: { 'X-WP-Nonce': wpApiSettings.nonce, 'Content-Type': 'application/json' },
body: JSON.stringify({ order_id: orderId, rule_data: ruleData })
});
return response.json();
};PHP – feature detection:
function is_order_daemon_pro_available(): bool {
$response = wp_remote_get(rest_url('odcm-pro/v1/debug-rule/search-orders?limit=1'), [
'headers' => ['X-WP-Nonce' => wp_create_nonce('wp_rest')],
]);
return !is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200;
}Error handling
Permission denied (403):
{
"code": "rest_forbidden",
"message": "Sorry, you are not allowed to do this.",
"data": { "status": 403 }
}Graceful fallback in JavaScript:
const saveRule = async (ruleId, ruleData) => {
const response = await fetch(`/wp-json/odcm/v1/rule/${ruleId}`, {
method: 'PUT',
headers: { 'X-WP-Nonce': wpApiSettings.nonce, 'Content-Type': 'application/json' },
body: JSON.stringify({ rule: ruleData })
});
if (!response.ok) {
const error = await response.json();
if (response.status === 403) {
// Show upgrade prompt or strip Pro components from rule
return handlePremiumRequired(ruleData);
}
throw new Error(error.message);
}
return response.json();
};