Transformation Rules API
v1Manage the rules that rewrite orders when they are imported or their products change: list, create, update, delete, validate and test.
Transformation rules rewrite orders automatically. Each rule is a GoRules document, sent as raw JSON in document, with one or more triggers that say when it runs:
| Trigger | Runs when |
|---|---|
TRIGGER_ORDER_IMPORT_CREATED | An order is created by an import. |
TRIGGER_ORDER_IMPORT_UPDATED | An order is updated by an import. |
TRIGGER_ORDER_IMPORT_MERGED | A newly imported order is merged into an existing one. |
TRIGGER_ORDER_PRODUCT_IMPORT_CHANGED | An order’s products are changed by the Product Upsert API. |
A rule’s label must be unique and decides the order rules run in. Its key is assigned when the rule is created and cannot be changed. When you update a rule, send back the version you read; it is an ETag.
Before saving a rule you can check the document with validate-rule, and run it against input of your own with test-rule. Neither stores anything.
Endpoints Overview
| Endpoint | Required access |
|---|---|
GET/v1/gorules/rulesReturns metadata for all rules defined in the authenticated client's organization | Integrations · View |
POST/v1/gorules/rulesCreates a new rule | Integrations · Edit |
GET/v1/gorules/rules/{key}Returns metadata for the specific rule identified by key, along with the raw GoRules rule document | Integrations · View |
PUT/v1/gorules/rules/{key}Updates an existing rule identified by key | Integrations · Edit |
DELETE/v1/gorules/rules/{key}Deletes an existing rule identified by key | Integrations · Full |
POST/v1/gorules/test-ruleTests an arbitrary GoRules rule with arbitrary input data | Integrations · Edit |
POST/v1/gorules/validate-ruleValidates a GoRules rule document | Integrations · Edit |
The badge is the access group and level an API client needs for the call. See access groups and levels.
Interactive API Explorer
Loading API Documentation...
Related documentation
- Orders Import - The import that triggers the rules
- Orders - Run or preview the rules on one order
- Authentication - API keys and access groups