2

We just want to know what would be the json params to create coupon code from magento2 rest API. The API we are using to generate the coupon code is /rest/V1/coupons

1

1 Answer 1

1

We can use http://devdocs.magento.com/swagger/#resource_salesRuleCouponManagementV1: /V1/coupons/generate to generate coupon for a rule:

Body JSON:

{
  "couponSpec": {
    "rule_id": 0,
    "format": "string",
    "quantity": 0,
    "length": 0,
    "prefix": "string",
    "suffix": "string",
    "delimiter_at_every": 0,
    "delimiter": "string",
    "extension_attributes": {}
  }
}
3
  • 1
    Thanks for the update, it did help me out, is there any API where we can create New rule for coupon code in magento and pass the coupon code with name, expire date, status.
    – harish
    Dec 21, 2016 at 14:07
  • You should go here: devdocs.magento.com/swagger > salesRuleRuleRepositoryV1 > /V1/salesRules Dec 21, 2016 at 14:11
  • @harish if my answer solved your issue, you can accept it as the solution. Jan 7, 2017 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.