我很难理解为什么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": {}
}
}'
如果我对此销售规则ID进行了获取请求,则会返回以下内容:
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处关注文档,以提出请求