younifyd
Menu

Put Rule Definition By Code

Create or update a rule definition

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

Use it in a workflow

  1. Add a step and choose the Akeneo connector.
  2. Pick the Put Rule Definition By Code action (under Rule definition).
  3. Fill in the fields below, then reference the result from later steps as {{putRuleDefinitionByCode.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.

Request body

Enter the body as JSON in the step's Body field.

typestringrequired

Rule type: product or record

One ofproductrecord

reference_entity_identifierstring | null

Reference entity identifier. Required when type is `record`, must be omitted or null for `product` rules.

conditionsarray<object>

Array of condition objects defining when the rule applies. Defaults to an empty array if omitted.

actionsarray<object>required

Array of action objects defining what changes to apply

labelsobject

Rule labels indexed by locale code

priorityinteger

Execution priority (higher runs first)

enabledboolean

Whether the rule is active

execution_typestring

Execution mode. Defaults to `scheduled` if omitted.

One oftriggeredscheduledworkflow_based

triggersarray<object>

Array of trigger objects defining which attribute changes trigger the rule. Only applicable for `triggered` execution_type on a product rule.

fieldstring

Attribute code that triggers the rule

localestring

Optional locale for localizable attributes

scopestring

Optional scope for scopable attributes

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

Response

Returns 201 with a any. Read it in later steps with {{putRuleDefinitionByCode.response.data.<field>}}.

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