Save sales rule

POST /V1/salesRules

Save sales rule.

Body

Responses

  • 200 Success.

    Hide response attributes Show response attributes object

    Interface RuleInterface

  • 401 Unauthorized

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Hide parameters attributes Show parameters attributes object

        Error parameters item

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object

      Error parameters item

    • trace string

      Stack trace

  • 400 Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Hide parameters attributes Show parameters attributes object

        Error parameters item

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object

      Error parameters item

    • trace string

      Stack trace

  • Internal Server error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Hide parameters attributes Show parameters attributes object

        Error parameters item

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object

      Error parameters item

    • trace string

      Stack trace

  • Unexpected error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters item

        Hide parameters attributes Show parameters attributes object

        Error parameters item

    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object

      Error parameters item

    • trace string

      Stack trace

POST /V1/salesRules
curl \
 -X POST https://magento2.winkelstraat.mac/rest/all/V1/salesRules \
 -d '{"rule":{"rule_id":42,"name":"string","store_labels":[{"store_id":42,"store_label":"string","extension_attributes":{}}],"description":"string","website_ids":[42],"customer_group_ids":[42],"from_date":"string","to_date":"string","uses_per_customer":42,"is_active":true,"condition":{"condition_type":"string","conditions":[{}],"aggregator_type":"string","operator":"string","attribute_name":"string","value":"string","extension_attributes":{}},"action_condition":{"condition_type":"string","conditions":[{}],"aggregator_type":"string","operator":"string","attribute_name":"string","value":"string","extension_attributes":{}},"stop_rules_processing":true,"is_advanced":true,"product_ids":[42],"sort_order":42,"simple_action":"string","discount_amount":42.0,"discount_qty":42.0,"discount_step":42,"apply_to_shipping":true,"times_used":42,"is_rss":true,"coupon_type":"string","use_auto_generation":true,"uses_per_coupon":42,"simple_free_shipping":"string","extension_attributes":{"reward_points_delta":42,"product_groups":["string"]}}}'
Request examples
{
  "rule": {
    "rule_id": 42,
    "name": "string",
    "store_labels": [
      {
        "store_id": 42,
        "store_label": "string",
        "extension_attributes": {}
      }
    ],
    "description": "string",
    "website_ids": [
      42
    ],
    "customer_group_ids": [
      42
    ],
    "from_date": "string",
    "to_date": "string",
    "uses_per_customer": 42,
    "is_active": true,
    "condition": {
      "condition_type": "string",
      "conditions": [
        {}
      ],
      "aggregator_type": "string",
      "operator": "string",
      "attribute_name": "string",
      "value": "string",
      "extension_attributes": {}
    },
    "action_condition": {
      "condition_type": "string",
      "conditions": [
        {}
      ],
      "aggregator_type": "string",
      "operator": "string",
      "attribute_name": "string",
      "value": "string",
      "extension_attributes": {}
    },
    "stop_rules_processing": true,
    "is_advanced": true,
    "product_ids": [
      42
    ],
    "sort_order": 42,
    "simple_action": "string",
    "discount_amount": 42.0,
    "discount_qty": 42.0,
    "discount_step": 42,
    "apply_to_shipping": true,
    "times_used": 42,
    "is_rss": true,
    "coupon_type": "string",
    "use_auto_generation": true,
    "uses_per_coupon": 42,
    "simple_free_shipping": "string",
    "extension_attributes": {
      "reward_points_delta": 42,
      "product_groups": [
        "string"
      ]
    }
  }
}
Response examples (200)
{
  "rule_id": 42,
  "name": "string",
  "store_labels": [
    {
      "store_id": 42,
      "store_label": "string",
      "extension_attributes": {}
    }
  ],
  "description": "string",
  "website_ids": [
    42
  ],
  "customer_group_ids": [
    42
  ],
  "from_date": "string",
  "to_date": "string",
  "uses_per_customer": 42,
  "is_active": true,
  "condition": {
    "condition_type": "string",
    "conditions": [
      {}
    ],
    "aggregator_type": "string",
    "operator": "string",
    "attribute_name": "string",
    "value": "string",
    "extension_attributes": {}
  },
  "action_condition": {
    "condition_type": "string",
    "conditions": [
      {}
    ],
    "aggregator_type": "string",
    "operator": "string",
    "attribute_name": "string",
    "value": "string",
    "extension_attributes": {}
  },
  "stop_rules_processing": true,
  "is_advanced": true,
  "product_ids": [
    42
  ],
  "sort_order": 42,
  "simple_action": "string",
  "discount_amount": 42.0,
  "discount_qty": 42.0,
  "discount_step": 42,
  "apply_to_shipping": true,
  "times_used": 42,
  "is_rss": true,
  "coupon_type": "string",
  "use_auto_generation": true,
  "uses_per_coupon": 42,
  "simple_free_shipping": "string",
  "extension_attributes": {
    "reward_points_delta": 42,
    "product_groups": [
      "string"
    ]
  }
}
Response examples (401)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (400)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (500)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (default)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}