List
DevelopingGET
/discountsConstant
Use the constants below according to the field names and rules for each request
Constant | Value |
---|---|
type |
COUPON OFFER PROMOTION FAST_OFFER |
Info
PROMOTION
andFAST_OFFER
are under development
Coupon Flow
Sample Case :
- Restaurant create a coupon for product A (10% off)
- Customers get a coupon code provided by the restaurant
- Customers buys product A according to the coupon
- Customers get discount
Offers Flow
Sample Case :
- Restaurant create an offer for product A for a week (10% off)
- Customers buys product A according to the offer
- CUstomers get discount
Validation
Field | Type | Rule | Description |
---|---|---|---|
page |
integer |
nullable min:1 |
Read more on the Pagination page |
per_page |
integer |
nullable min:1 |
Read more on the Pagination page |
search |
string |
nullable |
|
sort |
string |
nullable |
Read more on the Sorting page |
includes |
array |
nullable |
Read more on the Includables page |
filter.market_id |
string |
nullable |
Id from Market model |
filter.branch_id |
string |
nullable |
Id from Branch model |
filter.types |
array |
nullable |
Array of type |
filter.expired_at |
integer |
nullable |
Milliseconds time |
The rules on the fields will change depending on conditions, including the following
Field | Rule | Condition |
---|---|---|
filter.market_id |
required |
User authentication role SUBSCRIBER |
filter.branch_id |
required |
User authentication role SUBSCRIBER & has branch_id |
Request
Query Params
page
integer
optional
Example:
1
per_page
integer
optional
Example:
20
search
string
optional
sort
string
optional
includes
array[string]
optional
Example:
[""]
filter[market_id]
string
optional
Example:
b5d70a92-5d2e-4f89-8e52-1827cfbd01f4
filter[branch_id]
string
optional
filter[types]
array[string]
optional
filter[expired_at]
integer
optional
Request samples
Responses
OK(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
meta
object
required
code
integer
required
status
string
required
message
string
required
data
object
required
current_page
integer
required
data
array [object {13}]
required
first_page_url
string
required
from
integer
required
last_page
integer
required
last_page_url
string
required
links
array [object {3}]
required
next_page_url
null
required
path
string
required
per_page
integer
required
prev_page_url
null
required
to
integer
required
total
integer
required
Example
{
"meta": {
"code": 200,
"status": "success",
"message": "Data Loaded Successfully"
},
"data": {
"current_page": 1,
"data": [
{
"id": "05bc9506-8ba2-4463-a08d-7e440cea1a40",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": null,
"type": "COUPON",
"max": null,
"code": "12345",
"value": 15,
"value_type": "PERCENT",
"expired_at": null,
"created_at": 1696422628923,
"updated_at": 1696422628923,
"deleted_at": null,
"is_fast_offer": false
}
],
"first_page_url": "http://localhost:8000/api/v2/discounts?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://localhost:8000/api/v2/discounts?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "http://localhost:8000/api/v2/discounts?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "http://localhost:8000/api/v2/discounts",
"per_page": 20,
"prev_page_url": null,
"to": 1,
"total": 1
}
}
Last modified: 9 days ago