Skip to main content

Coupons

A discount coupon is a way for a store to provide discounts for its customers. There are three type of coupons. Percentage, absolute and shipping. The percentage type indicates that the value is a percentage discount. The type absolute indicates that the value is an absolute amount of discount. And finally the type shipping indicates that the discount value is on the shipping.

Properties

PropertyExplanation
idThe unique numeric identifier for the coupon.
codeString that identifies the coupon.
typeType of the coupon. Can take the following values: percentage, absolute or shipping.
validFlag (true or false) that indicates if the coupon is valid or not.
start_dateDate from which the coupon is valid.
end_dateDate of overdue of the coupon.
deleted_atDate when the coupon was deleted. The value is NULL if the coupon is still valid.
max_usesMax number of times the coupon can be used.
valueValue of the discount
min_priceIndicates the minimun value of the bill for applying the discount
categoriesList of Category objects representing the categories of the store where the discount applies.

Endpoints

GET /coupons

Receive a list of all Coupon.

ParameterExplanation
min_start_dateThe minimum start_date to filter.
min_end_dateThe minimum end_date to filter.
max_start_dateThe maximum start_date to filter.
max_end_dateThe maximum end_date to filter.
validFlag (true of false) for filtering valid coupons.
created_at_minShow Products created after date (ISO 8601 format)
created_at_maxShow Products created before date (ISO 8601 format)
updated_at_minShow Products last updated after date (ISO 8601 format)
updated_at_maxShow Products last updated before date (ISO 8601 format)
pagePage to show
per_pageAmount of results
fieldsComma-separated list of fields to include in the response

GET /coupons

HTTP/1.1 200 OK

[
{
"id": 32965,
"code": "PR2",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
},
{
"id": 32966,
"code": "PR23",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": null
},
{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
},
{
"id": 32963,
"code": "PR5",
"type": "percentage",
"value": "30.00",
"valid": false,
"used": 0,
"max_uses": null,
"start_date": null,
"end_date": null,
"min_price": 100,
"categories": [
{
"id": 105190,
"name": {
"es": "Pantalones",
"en": "Pantalones"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "pantalones",
"en": "pantalones"
},
"parent": null,
"subcategories": [
119258
],
"created_at": "2013-02-19T17:34:36+0000",
"updated_at": "2014-05-28T20:07:06+0000"
},
{
"id": 105191,
"name": {
"es": "Camisas",
"en": "Camisas"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "camisas",
"en": "camisas"
},
"parent": null,
"subcategories": [],
"created_at": "2013-02-19T17:34:37+0000",
"updated_at": "2014-05-28T20:07:06+0000"
},
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
}
]

GET /coupons?valid=true

HTTP/1.1 200 OK

[
{
"id": 32965,
"code": "PR2",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
},
{
"id": 32966,
"code": "PR23",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": null
},
{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
}
]

GET /coupons/{id}

Receive a single Coupon

GET /coupons/32964

HTTP/1.1 200 OK

{
"id": 32964,
"code": "PR4",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-06-07",
"end_date": "2014-06-08",
"min_price": 10,
"categories": [
{
"id": 117023,
"name": {
"es": "Oxido N\u00edtrico (NO2)",
"en": "Oxido N\u00edtrico (NO2)"
},
"description": {
"es": "",
"en": ""
},
"handle": {
"es": "oxido-nitrico-no2",
"en": "oxido-nitrico-no2"
},
"parent": null,
"subcategories": [],
"created_at": "2013-03-22T14:40:55+0000",
"updated_at": "2014-05-28T20:07:05+0000"
}
]
}

POST /coupons

Create a new Coupon

POST /coupons

ParameterExplanation
codeThe code is required. Must be unique and can contain only alfanumeric characters
valueThe value is mandatory if the type is percentage or absolute
{
"code": "PRUEBA",
"type": "percentage",
"value": "30.00",
"max_uses": 100,
"min_price": 10,
"categories": null,
"start_date": "2014-05-08",
"end_date": "2014-06-08"
}

HTTP/1.1 201 Created

{
"id": 32967,
"code": "PRUEBA",
"type": "percentage",
"value": "30.00",
"valid": true,
"used": null,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": null
}

PUT /coupons/{id}

Modify an existing coupon

PUT /coupons/32967

{
"code": "OTRAPRUEBA",
"type": "absolute",
"value": 50
}

HTTP/1.1 200 OK

{
"id": 32967,
"code": "OTRAPRUEBA",
"type": "absolute",
"value": 50,
"valid": true,
"used": 0,
"max_uses": 100,
"start_date": "2014-05-08",
"end_date": "2014-06-08",
"min_price": 10,
"categories": null
}

DELETE /coupons/{id}

Delete an existing coupon

DELETE /coupons/32967

HTTP/1.1 200 OK

{

}