woothemes/woocommerce — pull request #5044 by kloon (2014-03-05 06:30:31+00:00)
Title: Coupons API PUT POST DELETE

POST/PUT/DELETE Coupons implementation as per #4163

# Documentation
## Add Coupon
`POST /coupons`
### Data
Field | Info | Required
------ | ----- | -----------
code | The coupon code | Required
type | The type of discount | Optional
amount | The amount of discount | Optional
individual_use | Whether coupon can only be used individually | Optional
product_ids | Comma separated list of product ID's the coupon can be used on | Optional
exclude_product_ids | Comma separated list of product ID's the coupon cannot be used on | Optional
usage_limit | How many times the coupon can be used | Optional
usage_limit_per_user | How many times the coupon can be user per customer | Optional
limit_usage_to_x_items | Max number of items in the cart the coupon can be applied to | Optional
usage_count | Number of times the coupon has been used already | Optional
expiry_date | Date the coupon code expires | Optional
apply_before_tax | Should coupon be applied before tax | Optional
free_shipping | Is the coupon for free shipping | Optional
product_categories | Comma separated list of category ID's the coupon applies to | Optional
exclude_product_categories | Comma separated list of category ID's the coupon does not apply to | Optional
exclude_sale_items | Exclude sale items from the coupon | Optional
minimum_amount | Minimum order amount that needs to be in the cart before coupon applies | Optional
customer_email | Comma separates list of email addresses that can use this coupon | Optional
### Return
Returns the coupon data using `GET /coupons/

## Edit Coupon
`PUT /coupons/`
### Data
Field | Info | Required
------ | ----- | -----------
code | The coupon code | Optional
type | The type of discount | Optional
amount | The amount of discount | Optional
individual_use | Whether coupon can only be used individually | Optional
product_ids | Comma separated list of product ID's the coupon can be used on | Optional
exclude_product_ids | Comma separated list of product ID's the coupon cannot be used on | Optional
usage_limit | How many times the coupon can be used | Optional
usage_limit_per_user | How many times the coupon can be user per customer | Optional
limit_usage_to_x_items | Max number of items in the cart the coupon can be applied to | Optional
usage_count | Number of times the coupon has been used already | Optional
expiry_date | Date the coupon code expires | Optional
apply_before_tax | Should coupon be applied before tax | Optional
free_shipping | Is the coupon for free shipping | Optional
product_categories | Comma separated list of category ID's the coupon applies to | Optional
exclude_product_categories | Comma separated list of category ID's the coupon does not apply to | Optional
exclude_sale_items | Exclude sale items from the coupon | Optional
minimum_amount | Minimum order amount that needs to be in the cart before coupon applies | Optional
customer_email | Comma separates list of email addresses that can use this coupon | Optional
### Return
Returns the coupon data using `GET /coupons/

## Delete Coupon
`DELETE /coupons/`
### Return
Coupon deleted message