for owner
GET /api/v1/courses/:course_id/products/:product_id/coupons
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
GET /api/v1/courses/40/products/36/coupons?id=44&code=FOO&discount_percent=0.2&duration_kind=forever&expiration_date=2019-11-30
Query Parameters
id: 44
code: FOO
discount_percent: 0.2
duration_kind: forever
expiration_date: 2019-11-30
cURL
curl "http://localhost:3000/api/v1/courses/40/products/36/coupons?id=44&code=FOO&discount_percent=0.2&duration_kind=forever&expiration_date=2019-11-30" -X GET \
-H "Accept: application/json" \
-H "X-Api-Token: CPypaW1EKpcoHPAdqQ2BzzQjfGRF6hN3MA" \
-H "X-Api-Email: user-113@example.com" \
-H "Content-Type: application/json" \
-H "Host: school.worksonmy.computer"
Response
Headers
Status
200 OK
Body
{
"coupons": [
{
"created_at": "2019-10-31T21:59:15Z",
"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": "JVULFZWN",
"name": "One Off Coupon Code 2 dollars off",
"expiration_date": "2020-10-30T20:00:00-04:00",
"product_id": 36,
"is_published": true,
"duration_kind": "once",
"number_of_uses": null,
"class_period_id": null,
"site_wide": null,
"id": 44,
"meta": {
"class": "coupon",
"url": null,
"name": "One Off Coupon Code 2 dollars off",
"description": "",
"image_url": null
},
"product": {
"created_at": "2019-10-31T21:59:15Z",
"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": 40,
"author_revenue_share": null,
"num_payments_required": null,
"id": 36,
"meta": {
"class": "product",
"url": "/courses/40/products/36",
"name": "product name",
"description": "product description",
"image_url": null
}
}
}
],
"meta": {
"total": 1,
"page": 1,
"from": 1,
"to": 1,
"per": 25,
"number_of_pages": 1,
"query": {
"page": 1,
"multiple_use": null,
"course_id": "40",
"product_id": "36",
"is_published": true
}
}
}