PUT /V1/coupons/{couponId}

Save a coupon.

Path parameters

  • couponId string Required

Body

  • coupon object Required

    Interface CouponInterface

    Hide coupon attributes Show coupon attributes object
    • coupon_id integer

      Coupon id

    • rule_id integer Required

      The id of the rule associated with the coupon

    • code string

      Coupon code

    • usage_limit integer

      Usage limit

    • usage_per_customer integer

      Usage limit per customer

    • times_used integer Required

      The number of times the coupon has been used

    • expiration_date string

      Expiration date

    • is_primary boolean Required

      The coupon is primary coupon for the rule that it's associated with

    • created_at string

      When the coupon is created

    • type integer

      Of coupon

    • extension_attributes object

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

Body

  • coupon object Required

    Interface CouponInterface

    Hide coupon attributes Show coupon attributes object
    • coupon_id integer

      Coupon id

    • rule_id integer Required

      The id of the rule associated with the coupon

    • code string

      Coupon code

    • usage_limit integer

      Usage limit

    • usage_per_customer integer

      Usage limit per customer

    • times_used integer Required

      The number of times the coupon has been used

    • expiration_date string

      Expiration date

    • is_primary boolean Required

      The coupon is primary coupon for the rule that it's associated with

    • created_at string

      When the coupon is created

    • type integer

      Of coupon

    • extension_attributes object

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

Responses

  • 200 Success.

    Hide response attributes Show response attributes object
    • coupon_id integer

      Coupon id

    • rule_id integer Required

      The id of the rule associated with the coupon

    • code string

      Coupon code

    • usage_limit integer

      Usage limit

    • usage_per_customer integer

      Usage limit per customer

    • times_used integer Required

      The number of times the coupon has been used

    • expiration_date string

      Expiration date

    • is_primary boolean Required

      The coupon is primary coupon for the rule that it's associated with

    • created_at string

      When the coupon is created

    • type integer

      Of coupon

    • extension_attributes object

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

    Hide response attributes Show response attributes object
    • coupon_id integer

      Coupon id

    • rule_id integer Required

      The id of the rule associated with the coupon

    • code string

      Coupon code

    • usage_limit integer

      Usage limit

    • usage_per_customer integer

      Usage limit per customer

    • times_used integer Required

      The number of times the coupon has been used

    • expiration_date string

      Expiration date

    • is_primary boolean Required

      The coupon is primary coupon for the rule that it's associated with

    • created_at string

      When the coupon is created

    • type integer

      Of coupon

    • extension_attributes object

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

  • 401 Unauthorized

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • 400 Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • Internal Server error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

  • Unexpected error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Errors list

      Hide errors attributes Show errors attributes object

      Error details

      • message string

        Error message

      • parameters array[object]

        Error parameters list

        Hide parameters attributes Show parameters attributes object

        Error parameters item

        • resources string

          ACL resource

        • fieldName string

          Missing or invalid field name

        • fieldValue string

          Incorrect field value

    • code integer

      Error code

    • parameters array[object]

      Error parameters list

      Hide parameters attributes Show parameters attributes object

      Error parameters item

      • resources string

        ACL resource

      • fieldName string

        Missing or invalid field name

      • fieldValue string

        Incorrect field value

    • trace string

      Stack trace

PUT /V1/coupons/{couponId}
curl \
 --request PUT 'https://magento2.winkelstraat.mac/rest/all/V1/coupons/{couponId}' \
 --header "Content-Type: application/json" \
 --data '{"coupon":{"coupon_id":42,"rule_id":42,"code":"string","usage_limit":42,"usage_per_customer":42,"times_used":42,"expiration_date":"string","is_primary":true,"created_at":"string","type":42,"extension_attributes":{}}}'
curl \
 --request PUT 'https://magento2.winkelstraat.mac/rest/all/V1/coupons/{couponId}' \
 --header "Content-Type: application/xml"
Request examples
{
  "coupon": {
    "coupon_id": 42,
    "rule_id": 42,
    "code": "string",
    "usage_limit": 42,
    "usage_per_customer": 42,
    "times_used": 42,
    "expiration_date": "string",
    "is_primary": true,
    "created_at": "string",
    "type": 42,
    "extension_attributes": {}
  }
}
Request examples
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <coupon>
    <coupon-id type="integer">42</coupon-id>
    <rule-id type="integer">42</rule-id>
    <code>string</code>
    <usage-limit type="integer">42</usage-limit>
    <usage-per-customer type="integer">42</usage-per-customer>
    <times-used type="integer">42</times-used>
    <expiration-date>string</expiration-date>
    <is-primary type="boolean">true</is-primary>
    <created-at>string</created-at>
    <type type="integer">42</type>
    <extension-attributes>
    </extension-attributes>
  </coupon>
</root>
Response examples (200)
{
  "coupon_id": 42,
  "rule_id": 42,
  "code": "string",
  "usage_limit": 42,
  "usage_per_customer": 42,
  "times_used": 42,
  "expiration_date": "string",
  "is_primary": true,
  "created_at": "string",
  "type": 42,
  "extension_attributes": {}
}
Response examples (200)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <coupon-id type="integer">42</coupon-id>
  <rule-id type="integer">42</rule-id>
  <code>string</code>
  <usage-limit type="integer">42</usage-limit>
  <usage-per-customer type="integer">42</usage-per-customer>
  <times-used type="integer">42</times-used>
  <expiration-date>string</expiration-date>
  <is-primary type="boolean">true</is-primary>
  <created-at>string</created-at>
  <type type="integer">42</type>
  <extension-attributes>
  </extension-attributes>
</root>
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 (401)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <message>string</message>
  <errors type="array">
    <error>
      <message>string</message>
      <parameters type="array">
        <parameter>
          <resources>string</resources>
          <fieldName>string</fieldName>
          <fieldValue>string</fieldValue>
        </parameter>
      </parameters>
    </error>
  </errors>
  <code type="integer">42</code>
  <parameters type="array">
    <parameter>
      <resources>string</resources>
      <fieldName>string</fieldName>
      <fieldValue>string</fieldValue>
    </parameter>
  </parameters>
  <trace>string</trace>
</root>
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 (400)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <message>string</message>
  <errors type="array">
    <error>
      <message>string</message>
      <parameters type="array">
        <parameter>
          <resources>string</resources>
          <fieldName>string</fieldName>
          <fieldValue>string</fieldValue>
        </parameter>
      </parameters>
    </error>
  </errors>
  <code type="integer">42</code>
  <parameters type="array">
    <parameter>
      <resources>string</resources>
      <fieldName>string</fieldName>
      <fieldValue>string</fieldValue>
    </parameter>
  </parameters>
  <trace>string</trace>
</root>
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 (500)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <message>string</message>
  <errors type="array">
    <error>
      <message>string</message>
      <parameters type="array">
        <parameter>
          <resources>string</resources>
          <fieldName>string</fieldName>
          <fieldValue>string</fieldValue>
        </parameter>
      </parameters>
    </error>
  </errors>
  <code type="integer">42</code>
  <parameters type="array">
    <parameter>
      <resources>string</resources>
      <fieldName>string</fieldName>
      <fieldValue>string</fieldValue>
    </parameter>
  </parameters>
  <trace>string</trace>
</root>
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"
}
Response examples (default)
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <message>string</message>
  <errors type="array">
    <error>
      <message>string</message>
      <parameters type="array">
        <parameter>
          <resources>string</resources>
          <fieldName>string</fieldName>
          <fieldValue>string</fieldValue>
        </parameter>
      </parameters>
    </error>
  </errors>
  <code type="integer">42</code>
  <parameters type="array">
    <parameter>
      <resources>string</resources>
      <fieldName>string</fieldName>
      <fieldValue>string</fieldValue>
    </parameter>
  </parameters>
  <trace>string</trace>
</root>