Coupons

Getting a list of coupons

Endpoint

GET /v1/coupons

Parameters

Name Description
page Current page of coupons

Request

Query Parameters

page=0
curl "https://capi.storyblok.com/v1/coupons?page=0" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: Token token=MMQ781k1HVAchw7VNmlccQtt" \

Response

[

]

Getting a Coupon

Endpoint

GET /v1/coupons/:id

Request

curl "https://capi.storyblok.com/v1/coupons/1722" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: Token token=ocLP6hsBkQna3FQwjlidcgtt" \

Response

{
  "id": 1722,
  "code": "soNI5gCFke3IPSzonFQKMAtt",
  "start_date": null,
  "end_date": null,
  "max_uses": 0,
  "reduction_target": "price",
  "reduction_type": "percent",
  "reduction_amount": 10.0,
  "whole_order_coupon": true,
  "name": "",
  "free_shipping": false,
  "validate_master": false,
  "product_ids": [

  ]
}

Creating a Coupon

Endpoint

POST /v1/coupons

Parameters

Name Description
code required Coupon code
start_date Start date
end_date End date
whole_order_coupon Whole order coupon
max_uses Maximum uses
reduction_target required Reduction target: 'shipping' or 'price'
reduction_type required Reduction type: 'fixed' or 'percentage'
reduction_amount Reduction amount
name Name
free_shipping Free shipping
validate_master Validate master
product_ids Product ids

Request

curl "https://capi.storyblok.com/v1/coupons" -d '{"code":"XYZ","start_date":"2019-01-01","end_date":"2019-02-01","whole_order_coupon":"0","max_uses":"100","reduction_target":"price","reduction_type":"percent","reduction_amount":"10"}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: Token token=G0kcOAaoRcdfZOd16ZNB2gtt" \

Response

{
  "id": 1723,
  "code": "XYZ",
  "start_date": "2019-01-01",
  "end_date": "2019-02-01",
  "max_uses": 100,
  "reduction_target": "price",
  "reduction_type": "percent",
  "reduction_amount": 10.0,
  "whole_order_coupon": true,
  "name": "",
  "free_shipping": false,
  "validate_master": false,
  "product_ids": [

  ]
}

Updating a Coupon

Endpoint

PUT /v1/coupons/:id

Parameters

Name Description
code required Coupon code
start_date Start date
end_date End date
whole_order_coupon Whole order coupon
max_uses Maximum uses
reduction_target required Reduction target: 'shipping' or 'price'
reduction_type required Reduction type: 'fixed' or 'percentage'
reduction_amount Reduction amount
name Name
free_shipping Free shipping
validate_master Validate master
product_ids Product ids

Request

curl "https://capi.storyblok.com/v1/coupons/1724" -d '{"code":"XYZ","start_date":"2019-01-01","end_date":"2019-02-01","whole_order_coupon":"0","max_uses":"100","reduction_target":"price","reduction_type":"percent","reduction_amount":"10"}' -X PUT \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: Token token=YTGyKaa9MXvXAEPEQXJJnwtt" \

Response

{
  "id": 1724,
  "code": "XYZ",
  "start_date": "2019-01-01",
  "end_date": "2019-02-01",
  "max_uses": 100,
  "reduction_target": "price",
  "reduction_type": "percent",
  "reduction_amount": 10.0,
  "whole_order_coupon": false,
  "name": "",
  "free_shipping": false,
  "validate_master": false,
  "product_ids": [

  ]
}

Deleting a Coupon

Endpoint

DELETE /v1/coupons/:id

Request

curl "https://capi.storyblok.com/v1/coupons/1725" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: Token token=aGU9px3rF73BuQQmnphbZgtt" \