younifyd
Menu

Create salesRules

Create salesRules

POST/V1/salesRules

Use it in a workflow

  1. Add a step and choose the Adobe Commerce connector.
  2. Pick the Create salesRules action (under Promotions).
  3. Fill in the fields below, then reference the result from later steps as {{createSalesrules.response.data}}.

Fields

baseUrlstring

The API host this action calls. Override to point at a different environment.

Default "/rest/default"

bodystring

The request body content (for POST, PUT, PATCH requests).

forwardAllHeadersboolean

If enabled, all headers from the incoming request will be forwarded. Additional headers below will override forwarded ones.

Default false

headerskeyvalue

Extra HTTP headers to include, beyond what this action already declares. These override forwarded or declared headers with the same name.

queryParamskeyvalue

Extra URL query parameters to include, beyond what this action already declares. These override declared query parameters with the same name.

Response

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

rule_idinteger

Rule id

namestring

Rule name

store_labelsarray<object>

Display label

store_idintegerrequired

StoreId

store_labelstringrequired

The label for the store

extension_attributesobject

ExtensionInterface class for @see \Magento\SalesRule\Api\Data\RuleLabelInterface

descriptionstring

Description

website_idsarray<integer>

A list of websites the rule applies to

customer_group_idsarray<integer>

Ids of customer groups that the rule applies to

from_datestring

The start date when the coupon is active

to_datestring

The end date when the coupon is active

uses_per_customerinteger

Number of uses per customer

is_activeboolean

The coupon is active

conditionobject

Interface ConditionInterface

condition_typestringrequired

Condition type

conditionsarray<object>

List of conditions

aggregator_typestring

The aggregator type

operatorstringrequired

The operator of the condition

attribute_namestring

The attribute name of the condition

valuestringrequired

The value of the condition

extension_attributesobject1 fields

ExtensionInterface class for @see \Magento\SalesRule\Api\Data\ConditionInterface

action_conditionobject

Interface ConditionInterface

condition_typestringrequired

Condition type

conditionsarray<object>

List of conditions

aggregator_typestring

The aggregator type

operatorstringrequired

The operator of the condition

attribute_namestring

The attribute name of the condition

valuestringrequired

The value of the condition

extension_attributesobject1 fields

ExtensionInterface class for @see \Magento\SalesRule\Api\Data\ConditionInterface

stop_rules_processingboolean

To stop rule processing

is_advancedboolean

Is this field needed

product_idsarray<integer>

Product ids

sort_orderinteger

Sort order

simple_actionstring

Simple action of the rule

discount_amountnumber

Discount amount

discount_qtynumber

Maximum qty discount is applied

discount_stepinteger

Discount step

apply_to_shippingboolean

The rule applies to shipping

times_usedinteger

How many times the rule has been used

is_rssboolean

Whether the rule is in RSS

coupon_typestring

Coupon type

use_auto_generationboolean

To auto generate coupon

uses_per_couponinteger

Limit of uses per coupon

simple_free_shippingstring

To grant free shipping

extension_attributesobject

ExtensionInterface class for @see \Magento\SalesRule\Api\Data\RuleInterface

reward_points_deltainteger
json
{
  "website_ids": [
    0
  ],
  "customer_group_ids": [
    0
  ],
  "uses_per_customer": 0,
  "is_active": false,
  "stop_rules_processing": false,
  "is_advanced": false,
  "sort_order": 0,
  "discount_amount": 0,
  "discount_step": 0,
  "apply_to_shipping": false,
  "times_used": 0,
  "is_rss": false
}

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

Create salesRules — Adobe Commerce — Documentation