Coupon API
The Coupon API manages a store's coupons.
In this topic:
Fields
- user_id (string)
A unique id that represents a user account at Weebly. - site_id (string)
Site id unique to the user - coupon_id (string)
The unique coupon id (within the store) of the coupon. - code (string)
The coupon code the user enters. - summary (string)
A description of the coupon. - type (string)
The type of coupon. Use the following:
percent: percentage discount
absolute: an absolute amount discount
shipping: free shipping - amount (decimal)
The amount of the coupon, for example 5.00 for an absolute amount of $5.00. For percent types, enter a percentage amount, for example 20.00 for 20%. - start_date (string)
The starting date for which the coupon is valid. - end_date (string)
The ending date for which the coupon is valid. - criteria (string)
The limiting criteria for applying a coupon.
One of the following:
all: no limitations
total_over: only orders over X dollar amount
categories: only orders containing products from specific categories
products: only orders containing specific products - criteria_amount (decimal)
The amount - num_available (int)
The number of coupons available. - num_used (int)
The number of coupons used.
GET /user/USER_ID/site/SITE_ID/store/coupon
Returns the following fields for an array of the store's coupons:
- user_id
- site_id
- coupon_id
- summary
- code
- filterby (string)
Field name to set a filter on. - filterfor (string)
Value to search filterby field for.
You can use the following URL encoded operators with your filterfor parameter:- < use %3C
- > use %3E
- <= use %3C%3D
- >= use %3E%3D
Example CURL Request
Example Response
Example CURL Request with Search Parameters
Example Filtered Response
GET /user/USER_ID/site/SITE_ID/store/coupon/count
Returns the number of coupons for a store.
Example CURL Request
Example Response
GET /user/USER_ID/site/SITE_ID/store/coupon/COUPON_ID
Returns all fields for a given coupon.
Example CURL Request
Example Response
PATCH /user/USER_ID/site/SITE_ID/store/coupon/COUPON_ID
Updates a coupon. You can update the following:
- code
- type
- amount
- criteria
- criteria_amount
- product_ids
- category_ids
- shipping_rate_ids
Example CURL Request
Example Response
POST /user/USER_ID/site/SITE_ID/store/coupon
Creates a coupon.
Required:
Required:
- code
- type
- amount
- criteria
- criteria_amount (if criteria=total_over or all)
- product_ids (if criteria=products)
- category_ids (if criteria=categories)
- shipping_rate_ids (if criteria=shipping)
Example CURL Request
Example Response
PUT /user/USER_ID/site/SITE_ID/store/coupon/COUPON_ID
Replaces a coupon using the given values.
Required:
Required:
- code
- type
- amount
- criteria
- criteria_amount (if criteria=total_over or all)
- product_ids (if criteria=products)
- category_ids (if criteria=categories)
- shipping_rate_ids (if criteria=shipping)
Example CURL Request
Example Response
DELETE /user/USER_ID/site/SITE_ID/store/coupon/COUPON_ID
Deletes the coupon.
Example CURL Request
No response is returned.