FORMAT: 1A
Following Advanced Attributes, this example demonstrates defining arbitrary data structure to be reused by various attribute descriptions.
Since a portion of the Coupon
data structure is shared between the Coupon
definition itself and the Create a Coupon
action, it was separated into a Coupon Base
data structure in the Data Strucutes
API Blueprint Section. Doing so enables us to reuse it as a base-type of other attribute definitions.
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.
-
Parameters
-
id (string)
The ID of the desired coupon.
-
-
Attributes (Coupon Base)
- id: 250FF (string)
- created: 1415203908 (number) - Time stamp
Retrieves the coupon with the given ID.
- Response 200 (application/json)
- Attributes (Coupon)
- Attributes (array[Coupon])
Returns a list of your coupons.
-
Parameters
-
limit: 10 (optional)
A limit on the number of objects to be returned. Limit can range between 1 and 100 items.
-
-
Response 200 (application/json)
- Attributes (Coupons)
Creates a new Coupon.
-
Attributes (Coupon Base)
-
Request (application/json)
-
Response 200 (application/json)
- Attributes (Coupon)
-
percent_off: 25 (number)
A positive integer between 1 and 100 that represents the discount the coupon will apply.
-
redeem_by (number) - Date after which the coupon can no longer be redeemed