Endpoint
GET /rules/redirect/:redirectId
Retrieves all rules associated with a specific redirect, ordered by priority (ascending).
Path parameters
Response
Array of rule objects sorted by priority
Rule type: force, percentage, or ab_experiment
Evaluation priority (lower numbers evaluated first)
Current status: active, inactive, or draft
Array of conditions that must be metShow RuleCondition properties
User attribute to evaluate
value
string | number | string[] | number[] | [number, number]
Value to compare against
Query parameter name (when attribute is query_param)
How conditions are combined: AND or OR
Action to perform when rule matches
RedirectAction (type: force)
type: “redirect”
url: Destination URL
PercentageRedirectAction (type: percentage)
type: “percentage_redirect”
url: Destination URL
percentage: Traffic percentage (0-100)
ABTestAction (type: ab_experiment)
type: “ab_test”
variants: Array of variants with name, percentage, and url
Optional start date (ISO 8601)
Optional end date (ISO 8601)
Number of times this rule has matched
User who created the rule
metadata
Record<string, string | number | boolean>
Custom metadata key-value pairs
Creation timestamp (ISO 8601)
Last update timestamp (ISO 8601)
Examples
import { getRulesForRedirect } from '@quickleap/sdk';
const response = await getRulesForRedirect('redirect_123');
const rules = response.data.rules;
console.log(`Found ${rules.length} rules`);
rules.forEach(rule => {
console.log(`${rule.priority}: ${rule.name} (${rule.status})`);
});
Get rule by ID
To retrieve a single rule by its ID:
Path parameters
Response
The rule object (same structure as above)
Example
import { getRuleById } from '@quickleap/sdk';
const response = await getRuleById('rule_456');
const rule = response.data.rule;
console.log(`Rule: ${rule.name}`);
console.log(`Status: ${rule.status}`);
console.log(`Priority: ${rule.priority}`);
console.log(`Hit count: ${rule.hitCount}`);
Rules are always returned sorted by priority in ascending order. The first rule in the array has the highest priority and will be evaluated first.