Magento 2 купон генерирует API-исключения - PullRequest
0 голосов
/ 05 февраля 2019

Мне трудно понять, почему v1 / coupons / generate генерирует ошибку {"message":"One or more input exceptions have occurred."} (status_code 400). Я использую этот вызов для пакетной генерации 20 купонов:

curl -X POST path/index.php/rest/V1/coupons/generate \
-H "Authorization: Bearer TOKEN" \
-H "Content-type: application/json" -g \
-d '{
  "couponSpec": {
    "rule_id": 5,
    "format": "string",
    "quantity": 20,
    "length": 0,
    "prefix": "string",
    "suffix": "string",
    "delimiter_at_every": 0,
    "delimiter": "string",
    "extension_attributes": {}
  }
}'

Если я делаю запрос на получение этого правила продаж с идентификатором, я получаю следующее возвращаемое:

curl -X GET path/index.php/rest/V1/salesRules/5 \
-H "Authorization: Bearer TOKEN" \
{
  "rule_id": 5,
  "name": "test",
  "store_labels": [],
  "description": "",
  "website_ids": [
    1
  ],
  "customer_group_ids": [
    0,
    1,
    2,
    3
  ],
  "from_date": "2019-02-05",
  "to_date": "2019-02-06",
  "uses_per_customer": 1,
  "is_active": true,
  "condition": {
    "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Combine",
    "aggregator_type": "all",
    "operator": null,
    "value": true
  },
  "action_condition": {
    "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine",
    "aggregator_type": "all",
    "operator": null,
    "value": true
  },
  "stop_rules_processing": false,
  "is_advanced": true,
  "sort_order": 0,
  "simple_action": "by_percent",
  "discount_amount": 0,
  "discount_step": 0,
  "apply_to_shipping": false,
  "times_used": 0,
  "is_rss": true,
  "coupon_type": "SPECIFIC_COUPON",
  "use_auto_generation": true,
  "uses_per_coupon": 0,
  "simple_free_shipping": "0"
}

У меня нет ничего в моем файле exception.log - кто-нибудь сталкивался с этой конкретной проблемой и / или имеетнекоторые мысли о том, как устранить причину возникновения этой ошибки.

Я следовал документам здесь https://devdocs.magento.com/swagger/#resource_salesRuleCouponManagementV1, чтобы сделать запросы

...