Coupon - OgnianApostolov/builderly-api-docs GitHub Wiki
Model
Coupon coupon {
"_id": {
"autogenerated": "true"
},
"code": {
"type": "string",
"unique": "true",
"required": "true"
},
"name": {
"type": "string",
"unique": "true",
"required": "true"
},
"fixed_discount": {
"type": "number"
},
"percentage_discount": {
"type": "number"
},
"shipping_discount": {
"type": "number"
},
"sale_discount": {
"type": "number"
},
"quantity_discount": {
"buy": {
"type": "number"
},
"get": {
"type": "number"
}
},
"apply_to_all_orders": {
"type": "boolean"
},
"apply_to_all_products": {
"type": "boolean"
},
"apply_to_product": {
"type": "string"
},
"apply_to_collection": {
"type": "string"
},
"apply_to_minimum_subtotal": {
"type": "number"
},
"start_date": {
"type": "date"
},
"end_date": {
"type": "date"
},
"no_end_date": {
"type": "boolean",
"default": "false"
},
"limit_uses": {
"type": "number"
},
"uses": {
"type": "number"
}
}
Methods
Create new
POST /coupons
req.body required
method: 'POST'
{
url: 'https://{{your-builderly-domain}}/coupons,
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: coupon
}
Responses
Success - status 201
{}
Error - status 400
{
error_message
}
Retrieve multiple
GET /coupons
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/coupons',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
[coupons]
Error - status 500
{
error_message
}
- Example usages:
/comments
- Get all comments
Retrieve single
GET /coupons/:url
method: 'GET'
{
url: 'https://{{your-builderly-domain}}/coupons/{{coupons._id}}',
headers: {},
json: true,
body: {}
}
Responses
Success - status 200
{ coupon }
Not found - status 404
{}
Error - status 500
{
error_message
}
- Example usages:
/coupons/:url
- Retrives a specific coupon
Update single
PATCH /coupons/:id
method: 'PATCH'
{
url: 'https://{{your-builderly-domain}}/coupons/{{coupon._id}}',
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
{ coupon }
Error - status 400
{
error_message
}
Not found - status 404
{}
Delete single
DELETE /coupons/:id
method: 'DELETE'
{
url: 'https://{{your-builderly-domain}}/coupons/{{coupon._id}}',
headers: {
'Authorization': 'Bearer ' + token
},
json: true,
body: {}
}
Responses
Success - status 200
{ coupon }
Not found - status 404
{}
Error - status 500
{
error_message
}