Search Timeline
Use this api to add repeat
Flow: Add news repeat into db. Get the last timeline to set start time and end time.
If repeat type is monthly: add 1 month to time. If the date not exists, fallback to last day of this month.
If end time < start time and end time has same date as start time, set end time to the end of day.
URL : /internals/promotions/repeat/{id}/add
Method : POST
Validate Rule
'repeat_type' => ['required', 'in:daily,weekly,monthly,yearly'],
'rounds' => ['required', 'integer'],
'until' => ['nullable', 'date'],
Params Example
{
"repeat_type": "daily",
"rounds": "5",
"until": "2023-07-02 10:39:26"
}
Success Response
Code : 200 OK
Content example
{
"success": true,
"data": [
{
"id": 304,
"promotion_id": "187",
"start_time": "2023-04-02T06:00:00.000000Z",
"end_time": "2023-04-03T06:00:00.000000Z"
},
{
"id": 305,
"promotion_id": "187",
"start_time": "2023-04-03T06:00:00.000000Z",
"end_time": "2023-04-04T06:00:00.000000Z"
},
{
"id": 306,
"promotion_id": "187",
"start_time": "2023-04-04T06:00:00.000000Z",
"end_time": "2023-04-05T06:00:00.000000Z"
},
{
"id": 307,
"promotion_id": "187",
"start_time": "2023-04-05T06:00:00.000000Z",
"end_time": "2023-04-06T06:00:00.000000Z"
},
{
"id": 308,
"promotion_id": "187",
"start_time": "2023-04-06T06:00:00.000000Z",
"end_time": "2023-04-07T06:00:00.000000Z"
}
],
"error": [],
"errorCode": null
}
Error Response
Code : 400 BAD REQUEST
Content :
{
"success": false,
"data": null,
"error": {
"repeat_type": [
"The selected repeat type is invalid."
]
},
"errorCode": 400
}
Code : 500
Content :
{
"success": false,
"data": null,
"error": [
"Repeat type doesn't available for this promotion"
],
"errorCode": 500
}