|
1
|
get: |
|
2
|
operationId: GetPromotions |
|
3
|
summary: List Promotions |
|
4
|
description: >- |
|
5
|
Retrieve a list of promotions. The promotions can be filtered by fields such |
|
6
|
as `id`. The promotions can also be sorted or paginated. |
|
7
|
x-authenticated: true |
|
8
|
parameters: |
|
9
|
- name: fields |
|
10
|
in: query |
|
11
|
description: >- |
|
12
|
Comma-separated fields that should be included in the returned data. if |
|
13
|
a field is prefixed with `+` it will be added to the default fields, |
|
14
|
using `-` will remove it from the default fields. without prefix it will |
|
15
|
replace the entire default fields. |
|
16
|
required: false |
|
17
|
schema: |
|
18
|
type: string |
|
19
|
title: fields |
|
20
|
description: >- |
|
21
|
Comma-separated fields that should be included in the returned data. |
|
22
|
if a field is prefixed with `+` it will be added to the default |
|
23
|
fields, using `-` will remove it from the default fields. without |
|
24
|
prefix it will replace the entire default fields. |
|
25
|
externalDocs: |
|
26
|
url: '#select-fields-and-relations' |
|
27
|
- name: offset |
|
28
|
in: query |
|
29
|
description: The number of items to skip when retrieving a list. |
|
30
|
required: false |
|
31
|
schema: |
|
32
|
type: number |
|
33
|
title: offset |
|
34
|
description: The number of items to skip when retrieving a list. |
|
35
|
externalDocs: |
|
36
|
url: '#pagination' |
|
37
|
- name: limit |
|
38
|
in: query |
|
39
|
description: Limit the number of items returned in the list. |
|
40
|
required: false |
|
41
|
schema: |
|
42
|
type: number |
|
43
|
title: limit |
|
44
|
description: Limit the number of items returned in the list. |
|
45
|
externalDocs: |
|
46
|
url: '#pagination' |
|
47
|
- name: order |
|
48
|
in: query |
|
49
|
description: >- |
|
50
|
The field to sort the data by. By default, the sort order is ascending. |
|
51
|
To change the order to descending, prefix the field name with `-`. |
|
52
|
required: false |
|
53
|
schema: |
|
54
|
type: string |
|
55
|
title: order |
|
56
|
description: >- |
|
57
|
The field to sort the data by. By default, the sort order is |
|
58
|
ascending. To change the order to descending, prefix the field name |
|
59
|
with `-`. |
|
60
|
- name: q |
|
61
|
in: query |
|
62
|
description: Search term to filter the promotion's searchable attributes. |
|
63
|
required: false |
|
64
|
schema: |
|
65
|
type: string |
|
66
|
title: q |
|
67
|
description: Search term to filter the promotion's searchable attributes. |
|
68
|
- name: code |
|
69
|
in: query |
|
70
|
required: false |
|
71
|
schema: |
|
72
|
oneOf: |
|
73
|
- type: string |
|
74
|
title: code |
|
75
|
description: Filter by a promotion code. |
|
76
|
- type: array |
|
77
|
description: Filter by promotion codes. |
|
78
|
items: |
|
79
|
type: string |
|
80
|
title: code |
|
81
|
description: A promotion code. |
|
82
|
- name: campaign_id |
|
83
|
in: query |
|
84
|
required: false |
|
85
|
schema: |
|
86
|
oneOf: |
|
87
|
- type: string |
|
88
|
title: campaign_id |
|
89
|
description: Filter by a campaign's ID to retrieve its associated promotions. |
|
90
|
- type: array |
|
91
|
description: Filter by campaign IDs to retrieve their associated promotions. |
|
92
|
items: |
|
93
|
type: string |
|
94
|
title: campaign_id |
|
95
|
description: A campaign's ID. |
|
96
|
- name: application_method |
|
97
|
in: query |
|
98
|
description: >- |
|
99
|
Apply filters on the application methods to retrieve the promotions of |
|
100
|
the matching application methods. |
|
101
|
required: false |
|
102
|
schema: |
|
103
|
type: object |
|
104
|
description: >- |
|
105
|
Apply filters on the application methods to retrieve the promotions of |
|
106
|
the matching application methods. |
|
107
|
properties: |
|
108
|
currency_code: |
|
109
|
oneOf: |
|
110
|
- type: string |
|
111
|
title: currency_code |
|
112
|
description: Filter by a currency code. |
|
113
|
- type: array |
|
114
|
description: Filter by currency codes. |
|
115
|
items: |
|
116
|
type: string |
|
117
|
title: currency_code |
|
118
|
description: A currency code. |
|
119
|
- name: created_at |
|
120
|
in: query |
|
121
|
description: Filter by a promotion's creation date. |
|
122
|
required: false |
|
123
|
schema: |
|
124
|
type: object |
|
125
|
description: Filter by a promotion's creation date. |
|
126
|
properties: |
|
127
|
$and: |
|
128
|
type: array |
|
129
|
description: >- |
|
130
|
Join query parameters with an AND condition. Each object's content |
|
131
|
is the same type as the expected query parameters. |
|
132
|
items: |
|
133
|
type: object |
|
134
|
title: $and |
|
135
|
$or: |
|
136
|
type: array |
|
137
|
description: >- |
|
138
|
Join query parameters with an OR condition. Each object's content |
|
139
|
is the same type as the expected query parameters. |
|
140
|
items: |
|
141
|
type: object |
|
142
|
title: $or |
|
143
|
$eq: |
|
144
|
oneOf: |
|
145
|
- type: string |
|
146
|
title: $eq |
|
147
|
description: Filter by an exact match. |
|
148
|
- type: array |
|
149
|
description: Filter by an exact match. |
|
150
|
items: |
|
151
|
type: string |
|
152
|
title: $eq |
|
153
|
description: Filter by an exact match. |
|
154
|
$ne: |
|
155
|
type: string |
|
156
|
title: $ne |
|
157
|
description: Filter by values not equal to this parameter. |
|
158
|
$in: |
|
159
|
type: array |
|
160
|
description: Filter by values in this array. |
|
161
|
items: |
|
162
|
type: string |
|
163
|
title: $in |
|
164
|
description: Filter by values in this array. |
|
165
|
$nin: |
|
166
|
type: array |
|
167
|
description: Filter by values not in this array. |
|
168
|
items: |
|
169
|
type: string |
|
170
|
title: $nin |
|
171
|
description: Filter by values not in this array. |
|
172
|
$not: |
|
173
|
oneOf: |
|
174
|
- type: string |
|
175
|
title: $not |
|
176
|
description: >- |
|
177
|
Filter by values not matching the conditions in this |
|
178
|
parameter. |
|
179
|
- type: object |
|
180
|
description: >- |
|
181
|
Filter by values not matching the conditions in this |
|
182
|
parameter. |
|
183
|
- type: array |
|
184
|
description: >- |
|
185
|
Filter by values not matching the conditions in this |
|
186
|
parameter. |
|
187
|
items: |
|
188
|
type: string |
|
189
|
title: $not |
|
190
|
description: >- |
|
191
|
Filter by values not matching the conditions in this |
|
192
|
parameter. |
|
193
|
$gt: |
|
194
|
type: string |
|
195
|
title: $gt |
|
196
|
description: >- |
|
197
|
Filter by values greater than this parameter. Useful for numbers |
|
198
|
and dates only. |
|
199
|
$gte: |
|
200
|
type: string |
|
201
|
title: $gte |
|
202
|
description: >- |
|
203
|
Filter by values greater than or equal to this parameter. Useful |
|
204
|
for numbers and dates only. |
|
205
|
$lt: |
|
206
|
type: string |
|
207
|
title: $lt |
|
208
|
description: >- |
|
209
|
Filter by values less than this parameter. Useful for numbers and |
|
210
|
dates only. |
|
211
|
$lte: |
|
212
|
type: string |
|
213
|
title: $lte |
|
214
|
description: >- |
|
215
|
Filter by values less than or equal to this parameter. Useful for |
|
216
|
numbers and dates only. |
|
217
|
$like: |
|
218
|
type: string |
|
219
|
title: $like |
|
220
|
description: Apply a `like` filter. Useful for strings only. |
|
221
|
$re: |
|
222
|
type: string |
|
223
|
title: $re |
|
224
|
description: Apply a regex filter. Useful for strings only. |
|
225
|
$ilike: |
|
226
|
type: string |
|
227
|
title: $ilike |
|
228
|
description: Apply a case-insensitive `like` filter. Useful for strings only. |
|
229
|
$fulltext: |
|
230
|
type: string |
|
231
|
title: $fulltext |
|
232
|
description: Filter to apply on full-text properties. |
|
233
|
$overlap: |
|
234
|
type: array |
|
235
|
description: Filter arrays that have overlapping values with this parameter. |
|
236
|
items: |
|
237
|
type: string |
|
238
|
title: $overlap |
|
239
|
description: Filter arrays that have overlapping values with this parameter. |
|
240
|
$contains: |
|
241
|
type: array |
|
242
|
description: Filter arrays that contain some of the values of this parameter. |
|
243
|
items: |
|
244
|
type: string |
|
245
|
title: $contains |
|
246
|
description: Filter arrays that contain some of the values of this parameter. |
|
247
|
$contained: |
|
248
|
type: array |
|
249
|
description: Filter arrays that contain all values of this parameter. |
|
250
|
items: |
|
251
|
type: string |
|
252
|
title: $contained |
|
253
|
description: Filter arrays that contain all values of this parameter. |
|
254
|
$exists: |
|
255
|
type: boolean |
|
256
|
title: $exists |
|
257
|
description: Filter by whether a value for this parameter exists (not `null`). |
|
258
|
title: created_at |
|
259
|
- name: updated_at |
|
260
|
in: query |
|
261
|
description: Filter by a promotion's update date. |
|
262
|
required: false |
|
263
|
schema: |
|
264
|
type: object |
|
265
|
description: Filter by a promotion's update date. |
|
266
|
properties: |
|
267
|
$and: |
|
268
|
type: array |
|
269
|
description: >- |
|
270
|
Join query parameters with an AND condition. Each object's content |
|
271
|
is the same type as the expected query parameters. |
|
272
|
items: |
|
273
|
type: object |
|
274
|
title: $and |
|
275
|
$or: |
|
276
|
type: array |
|
277
|
description: >- |
|
278
|
Join query parameters with an OR condition. Each object's content |
|
279
|
is the same type as the expected query parameters. |
|
280
|
items: |
|
281
|
type: object |
|
282
|
title: $or |
|
283
|
$eq: |
|
284
|
oneOf: |
|
285
|
- type: string |
|
286
|
title: $eq |
|
287
|
description: Filter by an exact match. |
|
288
|
- type: array |
|
289
|
description: Filter by an exact match. |
|
290
|
items: |
|
291
|
type: string |
|
292
|
title: $eq |
|
293
|
description: Filter by an exact match. |
|
294
|
$ne: |
|
295
|
type: string |
|
296
|
title: $ne |
|
297
|
description: Filter by values not equal to this parameter. |
|
298
|
$in: |
|
299
|
type: array |
|
300
|
description: Filter by values in this array. |
|
301
|
items: |
|
302
|
type: string |
|
303
|
title: $in |
|
304
|
description: Filter by values in this array. |
|
305
|
$nin: |
|
306
|
type: array |
|
307
|
description: Filter by values not in this array. |
|
308
|
items: |
|
309
|
type: string |
|
310
|
title: $nin |
|
311
|
description: Filter by values not in this array. |
|
312
|
$not: |
|
313
|
oneOf: |
|
314
|
- type: string |
|
315
|
title: $not |
|
316
|
description: >- |
|
317
|
Filter by values not matching the conditions in this |
|
318
|
parameter. |
|
319
|
- type: object |
|
320
|
description: >- |
|
321
|
Filter by values not matching the conditions in this |
|
322
|
parameter. |
|
323
|
- type: array |
|
324
|
description: >- |
|
325
|
Filter by values not matching the conditions in this |
|
326
|
parameter. |
|
327
|
items: |
|
328
|
type: string |
|
329
|
title: $not |
|
330
|
description: >- |
|
331
|
Filter by values not matching the conditions in this |
|
332
|
parameter. |
|
333
|
$gt: |
|
334
|
type: string |
|
335
|
title: $gt |
|
336
|
description: >- |
|
337
|
Filter by values greater than this parameter. Useful for numbers |
|
338
|
and dates only. |
|
339
|
$gte: |
|
340
|
type: string |
|
341
|
title: $gte |
|
342
|
description: >- |
|
343
|
Filter by values greater than or equal to this parameter. Useful |
|
344
|
for numbers and dates only. |
|
345
|
$lt: |
|
346
|
type: string |
|
347
|
title: $lt |
|
348
|
description: >- |
|
349
|
Filter by values less than this parameter. Useful for numbers and |
|
350
|
dates only. |
|
351
|
$lte: |
|
352
|
type: string |
|
353
|
title: $lte |
|
354
|
description: >- |
|
355
|
Filter by values less than or equal to this parameter. Useful for |
|
356
|
numbers and dates only. |
|
357
|
$like: |
|
358
|
type: string |
|
359
|
title: $like |
|
360
|
description: Apply a `like` filter. Useful for strings only. |
|
361
|
$re: |
|
362
|
type: string |
|
363
|
title: $re |
|
364
|
description: Apply a regex filter. Useful for strings only. |
|
365
|
$ilike: |
|
366
|
type: string |
|
367
|
title: $ilike |
|
368
|
description: Apply a case-insensitive `like` filter. Useful for strings only. |
|
369
|
$fulltext: |
|
370
|
type: string |
|
371
|
title: $fulltext |
|
372
|
description: Filter to apply on full-text properties. |
|
373
|
$overlap: |
|
374
|
type: array |
|
375
|
description: Filter arrays that have overlapping values with this parameter. |
|
376
|
items: |
|
377
|
type: string |
|
378
|
title: $overlap |
|
379
|
description: Filter arrays that have overlapping values with this parameter. |
|
380
|
$contains: |
|
381
|
type: array |
|
382
|
description: Filter arrays that contain some of the values of this parameter. |
|
383
|
items: |
|
384
|
type: string |
|
385
|
title: $contains |
|
386
|
description: Filter arrays that contain some of the values of this parameter. |
|
387
|
$contained: |
|
388
|
type: array |
|
389
|
description: Filter arrays that contain all values of this parameter. |
|
390
|
items: |
|
391
|
type: string |
|
392
|
title: $contained |
|
393
|
description: Filter arrays that contain all values of this parameter. |
|
394
|
$exists: |
|
395
|
type: boolean |
|
396
|
title: $exists |
|
397
|
description: Filter by whether a value for this parameter exists (not `null`). |
|
398
|
title: updated_at |
|
399
|
- name: deleted_at |
|
400
|
in: query |
|
401
|
description: Filter by a promotion's deletion date. |
|
402
|
required: false |
|
403
|
schema: |
|
404
|
type: object |
|
405
|
description: Filter by a promotion's deletion date. |
|
406
|
properties: |
|
407
|
$and: |
|
408
|
type: array |
|
409
|
description: >- |
|
410
|
Join query parameters with an AND condition. Each object's content |
|
411
|
is the same type as the expected query parameters. |
|
412
|
items: |
|
413
|
type: object |
|
414
|
title: $and |
|
415
|
$or: |
|
416
|
type: array |
|
417
|
description: >- |
|
418
|
Join query parameters with an OR condition. Each object's content |
|
419
|
is the same type as the expected query parameters. |
|
420
|
items: |
|
421
|
type: object |
|
422
|
title: $or |
|
423
|
$eq: |
|
424
|
oneOf: |
|
425
|
- type: string |
|
426
|
title: $eq |
|
427
|
description: Filter by an exact match. |
|
428
|
- type: array |
|
429
|
description: Filter by an exact match. |
|
430
|
items: |
|
431
|
type: string |
|
432
|
title: $eq |
|
433
|
description: Filter by an exact match. |
|
434
|
$ne: |
|
435
|
type: string |
|
436
|
title: $ne |
|
437
|
description: Filter by values not equal to this parameter. |
|
438
|
$in: |
|
439
|
type: array |
|
440
|
description: Filter by values in this array. |
|
441
|
items: |
|
442
|
type: string |
|
443
|
title: $in |
|
444
|
description: Filter by values in this array. |
|
445
|
$nin: |
|
446
|
type: array |
|
447
|
description: Filter by values not in this array. |
|
448
|
items: |
|
449
|
type: string |
|
450
|
title: $nin |
|
451
|
description: Filter by values not in this array. |
|
452
|
$not: |
|
453
|
oneOf: |
|
454
|
- type: string |
|
455
|
title: $not |
|
456
|
description: >- |
|
457
|
Filter by values not matching the conditions in this |
|
458
|
parameter. |
|
459
|
- type: object |
|
460
|
description: >- |
|
461
|
Filter by values not matching the conditions in this |
|
462
|
parameter. |
|
463
|
- type: array |
|
464
|
description: >- |
|
465
|
Filter by values not matching the conditions in this |
|
466
|
parameter. |
|
467
|
items: |
|
468
|
type: string |
|
469
|
title: $not |
|
470
|
description: >- |
|
471
|
Filter by values not matching the conditions in this |
|
472
|
parameter. |
|
473
|
$gt: |
|
474
|
type: string |
|
475
|
title: $gt |
|
476
|
description: >- |
|
477
|
Filter by values greater than this parameter. Useful for numbers |
|
478
|
and dates only. |
|
479
|
$gte: |
|
480
|
type: string |
|
481
|
title: $gte |
|
482
|
description: >- |
|
483
|
Filter by values greater than or equal to this parameter. Useful |
|
484
|
for numbers and dates only. |
|
485
|
$lt: |
|
486
|
type: string |
|
487
|
title: $lt |
|
488
|
description: >- |
|
489
|
Filter by values less than this parameter. Useful for numbers and |
|
490
|
dates only. |
|
491
|
$lte: |
|
492
|
type: string |
|
493
|
title: $lte |
|
494
|
description: >- |
|
495
|
Filter by values less than or equal to this parameter. Useful for |
|
496
|
numbers and dates only. |
|
497
|
$like: |
|
498
|
type: string |
|
499
|
title: $like |
|
500
|
description: Apply a `like` filter. Useful for strings only. |
|
501
|
$re: |
|
502
|
type: string |
|
503
|
title: $re |
|
504
|
description: Apply a regex filter. Useful for strings only. |
|
505
|
$ilike: |
|
506
|
type: string |
|
507
|
title: $ilike |
|
508
|
description: Apply a case-insensitive `like` filter. Useful for strings only. |
|
509
|
$fulltext: |
|
510
|
type: string |
|
511
|
title: $fulltext |
|
512
|
description: Filter to apply on full-text properties. |
|
513
|
$overlap: |
|
514
|
type: array |
|
515
|
description: Filter arrays that have overlapping values with this parameter. |
|
516
|
items: |
|
517
|
type: string |
|
518
|
title: $overlap |
|
519
|
description: Filter arrays that have overlapping values with this parameter. |
|
520
|
$contains: |
|
521
|
type: array |
|
522
|
description: Filter arrays that contain some of the values of this parameter. |
|
523
|
items: |
|
524
|
type: string |
|
525
|
title: $contains |
|
526
|
description: Filter arrays that contain some of the values of this parameter. |
|
527
|
$contained: |
|
528
|
type: array |
|
529
|
description: Filter arrays that contain all values of this parameter. |
|
530
|
items: |
|
531
|
type: string |
|
532
|
title: $contained |
|
533
|
description: Filter arrays that contain all values of this parameter. |
|
534
|
$exists: |
|
535
|
type: boolean |
|
536
|
title: $exists |
|
537
|
description: Filter by whether a value for this parameter exists (not `null`). |
|
538
|
title: deleted_at |
|
539
|
- name: $and |
|
540
|
in: query |
|
541
|
required: false |
|
542
|
schema: |
|
543
|
type: array |
|
544
|
description: >- |
|
545
|
Join query parameters with an AND condition. Each object's content is |
|
546
|
the same type as the expected query parameters. |
|
547
|
items: |
|
548
|
type: object |
|
549
|
title: $and |
|
550
|
- name: $or |
|
551
|
in: query |
|
552
|
required: false |
|
553
|
schema: |
|
554
|
type: array |
|
555
|
description: >- |
|
556
|
Join query parameters with an OR condition. Each object's content is |
|
557
|
the same type as the expected query parameters. |
|
558
|
items: |
|
559
|
type: object |
|
560
|
title: $or |
|
561
|
- name: with_deleted |
|
562
|
in: query |
|
563
|
description: Whether to include deleted records in the result. |
|
564
|
required: false |
|
565
|
schema: |
|
566
|
type: boolean |
|
567
|
title: with_deleted |
|
568
|
description: Whether to include deleted records in the result. |
|
569
|
- name: id |
|
570
|
in: query |
|
571
|
required: false |
|
572
|
description: Filter by a promotion's ID. |
|
573
|
schema: |
|
574
|
oneOf: |
|
575
|
- type: string |
|
576
|
title: id |
|
577
|
description: Filter by a promotion's ID. |
|
578
|
- type: array |
|
579
|
description: Filter by promotion IDs. |
|
580
|
items: |
|
581
|
type: string |
|
582
|
title: id |
|
583
|
description: The promotion's ID. |
|
584
|
- type: object |
|
585
|
description: Filter by a promotion's ID. |
|
586
|
properties: |
|
587
|
$and: |
|
588
|
type: array |
|
589
|
description: >- |
|
590
|
Join query parameters with an AND condition. Each object's |
|
591
|
content is the same type as the expected query parameters. |
|
592
|
items: |
|
593
|
type: object |
|
594
|
title: $and |
|
595
|
$or: |
|
596
|
type: array |
|
597
|
description: >- |
|
598
|
Join query parameters with an OR condition. Each object's |
|
599
|
content is the same type as the expected query parameters. |
|
600
|
items: |
|
601
|
type: object |
|
602
|
title: $or |
|
603
|
$eq: |
|
604
|
oneOf: |
|
605
|
- type: string |
|
606
|
title: $eq |
|
607
|
description: Filter by an exact match. |
|
608
|
- type: array |
|
609
|
description: Filter by an exact match. |
|
610
|
items: |
|
611
|
type: string |
|
612
|
title: $eq |
|
613
|
description: Filter by an exact match. |
|
614
|
$ne: |
|
615
|
type: string |
|
616
|
title: $ne |
|
617
|
description: Filter by values not equal to this parameter. |
|
618
|
$in: |
|
619
|
type: array |
|
620
|
description: Filter by values in this array. |
|
621
|
items: |
|
622
|
type: string |
|
623
|
title: $in |
|
624
|
description: Filter by values in this array. |
|
625
|
$nin: |
|
626
|
type: array |
|
627
|
description: Filter by values not in this array. |
|
628
|
items: |
|
629
|
type: string |
|
630
|
title: $nin |
|
631
|
description: Filter by values not in this array. |
|
632
|
$not: |
|
633
|
oneOf: |
|
634
|
- type: string |
|
635
|
title: $not |
|
636
|
description: >- |
|
637
|
Filter by values not matching the conditions in this |
|
638
|
parameter. |
|
639
|
- type: object |
|
640
|
description: >- |
|
641
|
Filter by values not matching the conditions in this |
|
642
|
parameter. |
|
643
|
- type: array |
|
644
|
description: >- |
|
645
|
Filter by values not matching the conditions in this |
|
646
|
parameter. |
|
647
|
items: |
|
648
|
type: string |
|
649
|
title: $not |
|
650
|
description: >- |
|
651
|
Filter by values not matching the conditions in this |
|
652
|
parameter. |
|
653
|
$gt: |
|
654
|
type: string |
|
655
|
title: $gt |
|
656
|
description: >- |
|
657
|
Filter by values greater than this parameter. Useful for |
|
658
|
numbers and dates only. |
|
659
|
$gte: |
|
660
|
type: string |
|
661
|
title: $gte |
|
662
|
description: >- |
|
663
|
Filter by values greater than or equal to this parameter. |
|
664
|
Useful for numbers and dates only. |
|
665
|
$lt: |
|
666
|
type: string |
|
667
|
title: $lt |
|
668
|
description: >- |
|
669
|
Filter by values less than this parameter. Useful for numbers |
|
670
|
and dates only. |
|
671
|
$lte: |
|
672
|
type: string |
|
673
|
title: $lte |
|
674
|
description: >- |
|
675
|
Filter by values less than or equal to this parameter. Useful |
|
676
|
for numbers and dates only. |
|
677
|
$like: |
|
678
|
type: string |
|
679
|
title: $like |
|
680
|
description: Apply a `like` filter. Useful for strings only. |
|
681
|
$re: |
|
682
|
type: string |
|
683
|
title: $re |
|
684
|
description: Apply a regex filter. Useful for strings only. |
|
685
|
$ilike: |
|
686
|
type: string |
|
687
|
title: $ilike |
|
688
|
description: >- |
|
689
|
Apply a case-insensitive `like` filter. Useful for strings |
|
690
|
only. |
|
691
|
$fulltext: |
|
692
|
type: string |
|
693
|
title: $fulltext |
|
694
|
description: Filter to apply on full-text properties. |
|
695
|
$overlap: |
|
696
|
type: array |
|
697
|
description: >- |
|
698
|
Filter arrays that have overlapping values with this |
|
699
|
parameter. |
|
700
|
items: |
|
701
|
type: string |
|
702
|
title: $overlap |
|
703
|
description: >- |
|
704
|
Filter arrays that have overlapping values with this |
|
705
|
parameter. |
|
706
|
$contains: |
|
707
|
type: array |
|
708
|
description: >- |
|
709
|
Filter arrays that contain some of the values of this |
|
710
|
parameter. |
|
711
|
items: |
|
712
|
type: string |
|
713
|
title: $contains |
|
714
|
description: >- |
|
715
|
Filter arrays that contain some of the values of this |
|
716
|
parameter. |
|
717
|
$contained: |
|
718
|
type: array |
|
719
|
description: Filter arrays that contain all values of this parameter. |
|
720
|
items: |
|
721
|
type: string |
|
722
|
title: $contained |
|
723
|
description: Filter arrays that contain all values of this parameter. |
|
724
|
$exists: |
|
725
|
type: boolean |
|
726
|
title: $exists |
|
727
|
description: >- |
|
728
|
Filter by whether a value for this parameter exists (not |
|
729
|
`null`). |
|
730
|
security: |
|
731
|
- api_token: [] |
|
732
|
- cookie_auth: [] |
|
733
|
- jwt_token: [] |
|
734
|
x-codeSamples: |
|
735
|
- lang: JavaScript |
|
736
|
label: JS SDK |
|
737
|
source: |
|
738
|
$ref: ../code_samples/JavaScript/admin_promotions/get.js |
|
739
|
- lang: Shell |
|
740
|
label: cURL |
|
741
|
source: |
|
742
|
$ref: ../code_samples/Shell/admin_promotions/get.sh |
|
743
|
tags: |
|
744
|
- Promotions |
|
745
|
responses: |
|
746
|
'200': |
|
747
|
description: OK |
|
748
|
content: |
|
749
|
application/json: |
|
750
|
schema: |
|
751
|
allOf: |
|
752
|
- type: object |
|
753
|
description: The paginated list of promotions. |
|
754
|
required: |
|
755
|
- limit |
|
756
|
- offset |
|
757
|
- count |
|
758
|
properties: |
|
759
|
limit: |
|
760
|
type: number |
|
761
|
title: limit |
|
762
|
description: The maximum number of items returned. |
|
763
|
offset: |
|
764
|
type: number |
|
765
|
title: offset |
|
766
|
description: >- |
|
767
|
The number of items skipped before retrieving the returned |
|
768
|
items. |
|
769
|
count: |
|
770
|
type: number |
|
771
|
title: count |
|
772
|
description: The total number of items. |
|
773
|
- type: object |
|
774
|
description: The paginated list of promotions. |
|
775
|
required: |
|
776
|
- promotions |
|
777
|
properties: |
|
778
|
promotions: |
|
779
|
type: array |
|
780
|
description: The list of promotions. |
|
781
|
items: |
|
782
|
$ref: ../components/schemas/AdminPromotion.yaml |
|
783
|
'400': |
|
784
|
$ref: ../components/responses/400_error.yaml |
|
785
|
'401': |
|
786
|
$ref: ../components/responses/unauthorized.yaml |
|
787
|
'404': |
|
788
|
$ref: ../components/responses/not_found_error.yaml |
|
789
|
'409': |
|
790
|
$ref: ../components/responses/invalid_state_error.yaml |
|
791
|
'422': |
|
792
|
$ref: ../components/responses/invalid_request_error.yaml |
|
793
|
'500': |
|
794
|
$ref: ../components/responses/500_error.yaml |
|
795
|
post: |
|
796
|
operationId: PostPromotions |
|
797
|
summary: Create Promotion |
|
798
|
description: Create a promotion. |
|
799
|
x-authenticated: true |
|
800
|
parameters: |
|
801
|
- name: fields |
|
802
|
in: query |
|
803
|
description: >- |
|
804
|
Comma-separated fields that should be included in the returned data. if |
|
805
|
a field is prefixed with `+` it will be added to the default fields, |
|
806
|
using `-` will remove it from the default fields. without prefix it will |
|
807
|
replace the entire default fields. |
|
808
|
required: false |
|
809
|
schema: |
|
810
|
type: string |
|
811
|
title: fields |
|
812
|
description: >- |
|
813
|
Comma-separated fields that should be included in the returned data. |
|
814
|
if a field is prefixed with `+` it will be added to the default |
|
815
|
fields, using `-` will remove it from the default fields. without |
|
816
|
prefix it will replace the entire default fields. |
|
817
|
externalDocs: |
|
818
|
url: '#select-fields-and-relations' |
|
819
|
security: |
|
820
|
- api_token: [] |
|
821
|
- cookie_auth: [] |
|
822
|
- jwt_token: [] |
|
823
|
requestBody: |
|
824
|
content: |
|
825
|
application/json: |
|
826
|
schema: |
|
827
|
allOf: |
|
828
|
- type: object |
|
829
|
description: The promotion's details. |
|
830
|
required: |
|
831
|
- code |
|
832
|
- type |
|
833
|
- campaign_id |
|
834
|
- application_method |
|
835
|
properties: |
|
836
|
code: |
|
837
|
type: string |
|
838
|
title: code |
|
839
|
description: The promotion's code. |
|
840
|
is_automatic: |
|
841
|
type: boolean |
|
842
|
title: is_automatic |
|
843
|
description: Whether the promotion is applied automatically. |
|
844
|
type: |
|
845
|
type: string |
|
846
|
description: The promotion's type. |
|
847
|
externalDocs: |
|
848
|
url: >- |
|
849
|
https://docs.medusajs.com/resources/commerce-modules/promotion/concepts#what-is-a-promotion |
|
850
|
enum: |
|
851
|
- standard |
|
852
|
- buyget |
|
853
|
campaign_id: |
|
854
|
type: string |
|
855
|
title: campaign_id |
|
856
|
description: The ID of the campaign that the promotion belongs to. |
|
857
|
campaign: |
|
858
|
type: object |
|
859
|
description: >- |
|
860
|
The details of a campaign to create and add the promotion to |
|
861
|
it. |
|
862
|
required: |
|
863
|
- name |
|
864
|
- campaign_identifier |
|
865
|
- description |
|
866
|
- budget |
|
867
|
- starts_at |
|
868
|
- ends_at |
|
869
|
properties: |
|
870
|
name: |
|
871
|
type: string |
|
872
|
title: name |
|
873
|
description: The campaign's name. |
|
874
|
campaign_identifier: |
|
875
|
type: string |
|
876
|
title: campaign_identifier |
|
877
|
description: The campaign's identifier. |
|
878
|
description: |
|
879
|
type: string |
|
880
|
title: description |
|
881
|
description: The campaign's description. |
|
882
|
budget: |
|
883
|
type: object |
|
884
|
description: >- |
|
885
|
The campaign's budget which, when crossed, ends the |
|
886
|
campaign. |
|
887
|
required: |
|
888
|
- type |
|
889
|
- limit |
|
890
|
- currency_code |
|
891
|
properties: |
|
892
|
type: |
|
893
|
type: string |
|
894
|
description: > |
|
895
|
The budget's type. This can't be edited later. Use |
|
896
|
`spend` to set a limit on the total amount |
|
897
|
discounted by the campaign's promotions. Use `usage` |
|
898
|
to set a limit on the total number of times the |
|
899
|
campaign's promotions can be used. |
|
900
|
enum: |
|
901
|
- spend |
|
902
|
- usage |
|
903
|
limit: |
|
904
|
type: number |
|
905
|
title: limit |
|
906
|
description: The budget's limit. |
|
907
|
currency_code: |
|
908
|
type: string |
|
909
|
title: currency_code |
|
910
|
description: >- |
|
911
|
The campaign budget's currency code. This can't be |
|
912
|
edited later. |
|
913
|
starts_at: |
|
914
|
type: string |
|
915
|
title: starts_at |
|
916
|
description: The campaign's start date. |
|
917
|
format: date-time |
|
918
|
ends_at: |
|
919
|
type: string |
|
920
|
title: ends_at |
|
921
|
description: The campaign's end date. |
|
922
|
format: date-time |
|
923
|
application_method: |
|
924
|
type: object |
|
925
|
description: The promotion's application method. |
|
926
|
required: |
|
927
|
- description |
|
928
|
- value |
|
929
|
- currency_code |
|
930
|
- max_quantity |
|
931
|
- type |
|
932
|
- target_type |
|
933
|
- apply_to_quantity |
|
934
|
- buy_rules_min_quantity |
|
935
|
properties: |
|
936
|
description: |
|
937
|
type: string |
|
938
|
title: description |
|
939
|
description: The application method's description. |
|
940
|
value: |
|
941
|
type: number |
|
942
|
title: value |
|
943
|
description: >- |
|
944
|
The discounted amount applied by the associated |
|
945
|
promotion based on the `type`. |
|
946
|
currency_code: |
|
947
|
type: string |
|
948
|
title: currency_code |
|
949
|
description: The application method's currency code. |
|
950
|
max_quantity: |
|
951
|
type: number |
|
952
|
title: max_quantity |
|
953
|
description: >- |
|
954
|
The max quantity allowed in the cart for the associated |
|
955
|
promotion to be applied. |
|
956
|
type: |
|
957
|
type: string |
|
958
|
description: >- |
|
959
|
The type of the application method indicating how the |
|
960
|
associated promotion is applied. |
|
961
|
enum: |
|
962
|
- fixed |
|
963
|
- percentage |
|
964
|
target_type: |
|
965
|
type: string |
|
966
|
description: >- |
|
967
|
The target type of the application method indicating |
|
968
|
whether the associated promotion is applied to the |
|
969
|
cart's items, shipping methods, or the whole order. |
|
970
|
enum: |
|
971
|
- order |
|
972
|
- shipping_methods |
|
973
|
- items |
|
974
|
allocation: |
|
975
|
type: string |
|
976
|
description: >- |
|
977
|
The allocation value that indicates whether the |
|
978
|
associated promotion is applied on each item in a cart |
|
979
|
or split between the items in the cart. |
|
980
|
enum: |
|
981
|
- each |
|
982
|
- across |
|
983
|
target_rules: |
|
984
|
type: array |
|
985
|
description: The application method's target rules. |
|
986
|
items: |
|
987
|
type: object |
|
988
|
description: A target rule's details. |
|
989
|
required: |
|
990
|
- operator |
|
991
|
- description |
|
992
|
- attribute |
|
993
|
- values |
|
994
|
properties: |
|
995
|
operator: |
|
996
|
type: string |
|
997
|
description: >- |
|
998
|
The operator used to check whether the target rule |
|
999
|
applies on a cart. For example, `eq` means that |
|
1000
|
the cart's value for the specified attribute must |
|
1001
|
match the specified value. |
|
1002
|
enum: |
|
1003
|
- gte |
|
1004
|
- lte |
|
1005
|
- gt |
|
1006
|
- lt |
|
1007
|
- eq |
|
1008
|
- ne |
|
1009
|
- in |
|
1010
|
description: |
|
1011
|
type: string |
|
1012
|
title: description |
|
1013
|
description: The target rule's description. |
|
1014
|
attribute: |
|
1015
|
type: string |
|
1016
|
title: attribute |
|
1017
|
description: >- |
|
1018
|
The attribute to compare against when checking |
|
1019
|
whether a promotion can be applied on a cart. |
|
1020
|
example: items.product.id |
|
1021
|
values: |
|
1022
|
oneOf: |
|
1023
|
- type: string |
|
1024
|
title: values |
|
1025
|
description: The attribute's value. |
|
1026
|
example: prod_123 |
|
1027
|
- type: array |
|
1028
|
description: The allowed attribute values. |
|
1029
|
items: |
|
1030
|
type: string |
|
1031
|
title: values |
|
1032
|
description: An attribute value. |
|
1033
|
example: prod_123 |
|
1034
|
buy_rules: |
|
1035
|
type: array |
|
1036
|
description: The application method's buy rules. |
|
1037
|
items: |
|
1038
|
type: object |
|
1039
|
description: A buy rule's details. |
|
1040
|
required: |
|
1041
|
- operator |
|
1042
|
- description |
|
1043
|
- attribute |
|
1044
|
- values |
|
1045
|
properties: |
|
1046
|
operator: |
|
1047
|
type: string |
|
1048
|
description: >- |
|
1049
|
The operator used to check whether the buy rule |
|
1050
|
applies on a cart. For example, `eq` means that |
|
1051
|
the cart's value for the specified attribute must |
|
1052
|
match the specified value. |
|
1053
|
enum: |
|
1054
|
- gte |
|
1055
|
- lte |
|
1056
|
- gt |
|
1057
|
- lt |
|
1058
|
- eq |
|
1059
|
- ne |
|
1060
|
- in |
|
1061
|
description: |
|
1062
|
type: string |
|
1063
|
title: description |
|
1064
|
description: The buy rule's description. |
|
1065
|
attribute: |
|
1066
|
type: string |
|
1067
|
title: attribute |
|
1068
|
description: >- |
|
1069
|
The attribute to compare against when checking |
|
1070
|
whether a promotion can be applied on a cart. |
|
1071
|
example: items.product.id |
|
1072
|
values: |
|
1073
|
oneOf: |
|
1074
|
- type: string |
|
1075
|
title: values |
|
1076
|
description: The attribute's value. |
|
1077
|
example: prod_123 |
|
1078
|
- type: array |
|
1079
|
description: The allowed attribute values. |
|
1080
|
items: |
|
1081
|
type: string |
|
1082
|
title: values |
|
1083
|
description: An attribute value. |
|
1084
|
example: prod_123 |
|
1085
|
apply_to_quantity: |
|
1086
|
type: number |
|
1087
|
title: apply_to_quantity |
|
1088
|
description: >- |
|
1089
|
The quantity that results from matching the `buyget` |
|
1090
|
promotion's condition. For example, if the promotion is |
|
1091
|
a "Buy 2 shirts get 1 free", the value f this attribute |
|
1092
|
is `1`. |
|
1093
|
buy_rules_min_quantity: |
|
1094
|
type: number |
|
1095
|
title: buy_rules_min_quantity |
|
1096
|
description: >- |
|
1097
|
The minimum quantity required for a `buyget` promotion |
|
1098
|
to be applied. For example, if the promotion is a "Buy 2 |
|
1099
|
shirts get 1 free", the value of this attribute is `2`. |
|
1100
|
rules: |
|
1101
|
type: array |
|
1102
|
description: The promotion's rules. |
|
1103
|
items: |
|
1104
|
type: object |
|
1105
|
description: A rule's details. |
|
1106
|
required: |
|
1107
|
- operator |
|
1108
|
- description |
|
1109
|
- attribute |
|
1110
|
- values |
|
1111
|
properties: |
|
1112
|
operator: |
|
1113
|
type: string |
|
1114
|
description: >- |
|
1115
|
The operator used to check whether the buy rule |
|
1116
|
applies on a cart. For example, `eq` means that the |
|
1117
|
cart's value for the specified attribute must match |
|
1118
|
the specified value. |
|
1119
|
enum: |
|
1120
|
- gte |
|
1121
|
- lte |
|
1122
|
- gt |
|
1123
|
- lt |
|
1124
|
- eq |
|
1125
|
- ne |
|
1126
|
- in |
|
1127
|
description: |
|
1128
|
type: string |
|
1129
|
title: description |
|
1130
|
description: The rule's description. |
|
1131
|
attribute: |
|
1132
|
type: string |
|
1133
|
title: attribute |
|
1134
|
description: >- |
|
1135
|
The attribute to compare against when checking whether |
|
1136
|
a promotion can be applied on a cart. |
|
1137
|
example: items.product.id |
|
1138
|
values: |
|
1139
|
oneOf: |
|
1140
|
- type: string |
|
1141
|
title: values |
|
1142
|
description: The attribute's value. |
|
1143
|
example: prod_123 |
|
1144
|
- type: array |
|
1145
|
description: The allowed attribute values. |
|
1146
|
items: |
|
1147
|
type: string |
|
1148
|
title: values |
|
1149
|
description: An attribute value. |
|
1150
|
example: prod_123 |
|
1151
|
- type: object |
|
1152
|
description: The promotion's details. |
|
1153
|
properties: |
|
1154
|
additional_data: |
|
1155
|
type: object |
|
1156
|
description: >- |
|
1157
|
Pass additional custom data to the API route. This data is |
|
1158
|
passed to the underlying workflow under the |
|
1159
|
`additional_data` parameter. |
|
1160
|
description: The promotion's details. |
|
1161
|
x-codeSamples: |
|
1162
|
- lang: JavaScript |
|
1163
|
label: JS SDK |
|
1164
|
source: |
|
1165
|
$ref: ../code_samples/JavaScript/admin_promotions/post.js |
|
1166
|
- lang: Shell |
|
1167
|
label: cURL |
|
1168
|
source: |
|
1169
|
$ref: ../code_samples/Shell/admin_promotions/post.sh |
|
1170
|
tags: |
|
1171
|
- Promotions |
|
1172
|
responses: |
|
1173
|
'200': |
|
1174
|
description: OK |
|
1175
|
content: |
|
1176
|
application/json: |
|
1177
|
schema: |
|
1178
|
$ref: ../components/schemas/AdminPromotionResponse.yaml |
|
1179
|
'400': |
|
1180
|
$ref: ../components/responses/400_error.yaml |
|
1181
|
'401': |
|
1182
|
$ref: ../components/responses/unauthorized.yaml |
|
1183
|
'404': |
|
1184
|
$ref: ../components/responses/not_found_error.yaml |
|
1185
|
'409': |
|
1186
|
$ref: ../components/responses/invalid_state_error.yaml |
|
1187
|
'422': |
|
1188
|
$ref: ../components/responses/invalid_request_error.yaml |
|
1189
|
'500': |
|
1190
|
$ref: ../components/responses/500_error.yaml |
|
1191
|
x-workflow: createPromotionsWorkflow |
|
1192
|
x-events: [] |