API
Docs and API's for Weasy.io
Coupons
Manage all the coupons available in your website.Accepts GET POST PUT DELETE
All requests to the API must be authenticated with an API key on the HTTP Authorization header.
GET
Manage all the coupons available in your websiteRequest example
~ curl -i -X GET \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
https://api.weasy.io/v1/coupons
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
https://api.weasy.io/v1/coupons
Body response example [ HTTP CODE: 200 ]
Path parameters
| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| limit | integer | optional | define items per page |
| page | integer | optional | define page to display |
POST
Add a coupon to your website.Request example
~ curl -i -X POST \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[{"coupon":"DITBRRU","status":1,"duedate":"2018-02-25","type":"%","value":10,"max_uses":20,"lang":"en","free_shipping":1,"minimum_checkout_value":15.50},...]'\
https://api.weasy.io/v1/coupons
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[{"coupon":"DITBRRU","status":1,"duedate":"2018-02-25","type":"%","value":10,"max_uses":20,"lang":"en","free_shipping":1,"minimum_checkout_value":15.50},...]'\
https://api.weasy.io/v1/coupons
Body response example [ HTTP CODE: 200 ]
Body attributes
A json payload containing the following attributes.| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| coupon | string | required | coupon code |
| status | integer | required | status of the coupon options: 0 for inactive, 1 for active |
| duedate | date | required | expiration date of the coupon |
| type | string | required | type of the discount options: % for percentage discount, moeda for amount discount |
| value | float | required | discount value |
| max_uses | int | required | number of times the coupon can be used options: 0 for unlimeted, >0 for number limit |
| lang | string | required | language for the coupon options: all the iso language codes are obtained from the languages endpoint |
| customer_id | string | optional | customer id which the coupon is valid for options: customer codes are obtained from the customers endpoint |
| free_shipping | int | optional | number of times the coupon can be used options: 0 for free shipping, >0 for disable free shipping |
| affect_discount | int | optional (default 1) | where to apply discount options: 1 all products 2 only products with promo price 3 only products without promo price |
| brands | string | optional | brands in which this coupon is valid options: brands codes are obtained from the brands endpoint |
| categories | string | optional | categories in which this coupon is valid options: categories codes are obtained from the categories endpoint |
| minimum_checkout_value | float | optional | amount which the coupon can be activated |
PUT
Change a coupon from your website.Request example
~ curl -i -X PUT \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '{"duedate":"2019-01-14","free_shipping":1}'\
https://api.weasy.io/v1/coupons/1
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '{"duedate":"2019-01-14","free_shipping":1}'\
https://api.weasy.io/v1/coupons/1
Body response example [ HTTP CODE: 200 ]
Path parameters
| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| id | integer | required | url forward id |
Body attributes
A json payload containing the following attributes.| NAME | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
| coupon | string | optional | coupon code |
| status | integer | optional | status of the coupon options: 0 for inactive, 1 for active |
| duedate | date | optional | expiration date of the coupon |
| type | string | optional | type of the discount options: % for percentage discount, moeda for amount discount |
| value | float | optional | discount value |
| max_uses | int | optional | number of times the coupon can be used options: 0 for unlimeted, >0 for number limit |
| times_used | int | optional | number of times the coupon was already used |
| lang | string | optional | language for the coupon options: all the iso language codes are obtained from the languages endpoint |
| customer_id | string | optional | customer id which the coupon is valid for options: customer codes are obtained from the customers endpoint |
| free_shipping | int | optional | number of times the coupon can be used options: 0 for free shipping, >0 for disable free shipping |
| affect_discount | int | optional (default 1) | where to apply discount options: 1 all products 2 only products with promo price 3 only products without promo price |
| brands | string | optional | brands in which this coupon is valid options: brands codes are obtained from the brands endpoint |
| categories | string | optional | categories in which this coupon is valid options: categories codes are obtained from the categories endpoint |
| minimum_checkout_value | float | optional | amount which the coupon can be activated |
DELETE
Delete a coupon or collection of coupons from your website.Request example
~ curl -i -X DELETE \
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[1,2]'\
https://api.weasy.io/v1/coupons
-H 'X-API-KEY:xsFPVLn7aOllXixPDaGBgCZpyTmyX7G6CniNtKD' \
-H 'Content-Type:application/json' \
-d '[1,2]'\
https://api.weasy.io/v1/coupons
Body response example [ HTTP CODE: 200 ]
Body attributes
| Attribute description |
|---|
| A json payload containing an array of id or ids. Use GET for collect all the ids. |