PUT - /api/v1/courses/:course_id/products/:product_id/coupons/:id - Updating
PUT /api/v1/courses/:course_id/products/:product_id/coupons/:id
Parameters
| Name |
Description |
|
id
|
coupon id
|
|
is_primary
|
primary coupon?
|
|
code
|
:text
|
|
currency
|
:string(255)
|
|
discount_amount
|
:integer
|
|
discount_in_months
|
:integer
|
|
discount_percent
|
:float
|
|
duration_kind
|
forever, once, or repeating
|
|
expiration_date
|
:date
|
|
is_published
|
:boolean
|
|
name
|
:text
|
|
number_available
|
:integer
|
|
number_of_uses
|
:integer
|
|
product_id
|
id
|
|
course_id
|
course id
|
Request
Headers
Route
PUT /api/v1/courses/42/products/38/coupons/46
Body
{"code":"FOO","discount_percent":0.2,"duration_kind":"forever","expiration_date":"2019-11-30"}
cURL
curl "http://localhost:3000/api/v1/courses/42/products/38/coupons/46" -d '{"code":"FOO","discount_percent":0.2,"duration_kind":"forever","expiration_date":"2019-11-30"}' -X PUT \
-H "Accept: application/json" \
-H "X-Api-Token: NMT_7yX5-NTHeCFQy6fxFESTFrzdyB9o2g" \
-H "X-Api-Email: user-117@example.com" \
-H "Content-Type: application/json" \
-H "Host: school.worksonmy.computer"
Response
Headers
Status
202 Accepted
Body
{
"created_at": "2019-10-31T21:59:18Z",
"new_purchase_price": 900,
"formatted_discount": "$1",
"formatted_price": "$9",
"calculated_discount": 100,
"currency": "USD",
"discount_percent": null,
"discount_amount": 100,
"number_available": 10000,
"code": "DXSMOWKG",
"name": "One Off Coupon Code 2 dollars off",
"expiration_date": "2019-11-29T19:00:00-05:00",
"product_id": 38,
"is_published": true,
"duration_kind": "once",
"number_of_uses": null,
"class_period_id": null,
"site_wide": null,
"id": 46,
"meta": {
"class": "coupon",
"url": null,
"name": "One Off Coupon Code 2 dollars off",
"description": "",
"image_url": null
},
"product": {
"created_at": "2019-10-31T21:59:18Z",
"formatted_price": "$10",
"name": "product name",
"description": "product description",
"billing_interval": "month",
"detailed_description": null,
"currency": "USD",
"position": 1,
"price": 1000,
"is_recurring": false,
"is_published": true,
"course_id": 42,
"author_revenue_share": null,
"num_payments_required": null,
"id": 38,
"meta": {
"class": "product",
"url": "/courses/42/products/38",
"name": "product name",
"description": "product description",
"image_url": null
}
}
}