Discount rule or promotion that can be applied to orders. Tracks discount code, type, value, eligibility requirements, usage limits, and expiration.
https://api.mockly.codes/discounts?page=1&limit=10&count=10Configure your request and click Send Request to see the response here.
/discountsGet a collection of discounts
/commerce/discounts/discounts/:idGet a single discount by ID
/commerce/discounts/:id/discounts/metaGet resource metadata and schema
/commerce/discounts/metaThe search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.
Search across all text fields:
GET https://api.mockly.codes/discounts?q=laptopGET https://api.mockly.codes/discounts?q=laptop&search_fields=name,descriptionsearch_fields, all text fields are searched// Get 10 discounts
fetch('https://api.mockly.codes/discounts?count=10')
.then(res => res.json())
.then(data => console.log(data));import requests
response = requests.get(
'https://api.mockly.codes/discounts?count=10'
)
data = response.json()curl "https://api.mockly.codes/discounts?count=10"fetch('https://api.mockly.codes/discounts?nocache=true')idintegerUnique identifier for the discount
random_intcodestringUnique discount code or identifier used to apply the discount
uuidtypestringType of discount (e.g., percentage, fixed_amount, buy_one_get_one)
wordvaluenumberDiscount value - percentage (5-100) or fixed amount depending on type
floatminimum_purchasenumberMinimum order value required to qualify for this discount
pricemax_usesintegerMaximum number of times this discount can be redeemed
random_intused_countintegerCurrent number of times this discount has been used
random_intexpires_atstringDate when the discount expires and is no longer valid
future_datedatecountintegerNumber of items to return (default: 10, max: 100)
seedintegerSeed for reproducible data generation
nocachebooleanBypass cache and generate fresh data on every request