younifyd
Menu

Get Rule Definition By Code

Get a rule definition

GET/api/rest/v1/rule-definitions/{code}

Use it in a workflow

  1. Add a step and choose the Akeneo connector.
  2. Pick the Get Rule Definition By Code action (under Rule definition).
  3. Fill in the fields below, then reference the result from later steps as {{getRuleDefinitionByCode.response.data}}.

Request

Path parameters

codestringrequired

This path parameter is used to specify the unique identifier of the entity you want to retrieve or manipulate. It is essential for identifying the specific entity in the API requests. Ensure that the code is correctly formatted and corresponds to an existing entity in the system.

Response

Returns 200 with an object. Read it in later steps with {{getRuleDefinitionByCode.response.data.<field>}}.

codestring

Unique rule definition code

typestring

Rule type: product or record

One ofproductrecord

execution_typestring

Execution mode: triggered, scheduled, or workflow_based

enabledboolean

Whether the rule is active

priorityinteger

Execution priority (higher runs first)

reference_entity_identifierstring | null

Reference entity identifier. Required when type is `record`, null otherwise.

labelsobject

Rule labels indexed by locale code

conditionsarray<object>

Array of condition objects defining when the rule applies

actionsarray<object>

Array of action objects defining what changes to apply

triggersarray<object>

Array of trigger objects defining which attribute changes trigger the rule (only for triggered execution_type on product)

fieldstring

Attribute code that triggers the rule

localestring

Optional locale for localizable attributes

scopestring

Optional scope for scopable attributes

action_typesarray<string>

List of action types used in this rule

json
{
  "code": "my_rule",
  "type": "product",
  "execution_type": "triggered",
  "enabled": true,
  "priority": 10,
  "reference_entity_identifier": "brand",
  "labels": {
    "en_US": "My rule"
  },
  "conditions": [
    {
      "field": "family",
      "operator": "IN",
      "value": [
        "shoes"
      ]
    }
  ],
  "actions": [
    {
      "type": "set",
      "field": "description",
      "value": "Default description",
      "locale": "en_US",
      "scope": "ecommerce"
    }
  ],
  "triggers": [
    {
      "field": "name"
    },
    {
      "field": "description",
      "locale": "en_US",
      "scope": "ecommerce"
    }
  ],
  "action_types": [
    "set"
  ]
}

Need more? See the Akeneo guide for connection setup and behaviour shared by every action.