-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-specification.yaml
2521 lines (2220 loc) · 70.4 KB
/
api-specification.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: Boundless-commerce API
version: 1.1.29
contact:
name: Support team
email: info@boundless-commerce.com
description: >
# API client
The most simple way to start using the API is by using our [API client (JS)](https://github.com/kirill-zhirnov/boundless-api-client).
# Authentication
## Token types
There are 2 types of access tokens: permanent tokens and generated ones. The generated ones is a more secure way.
### Using permanent token:
Generate a permanent token in your control panel and pass it with each request as Authorization header:
```
Authorization: Bearer <YOUR TOKEN>
```
### How to generate token?
A token is a JWT token with payload keys:
- `iId` - your instance ID (copy from token-generation dialog)
- `cId` - your client ID (copy from token-generation dialog)
Algorithm: `HS512`
Generated token must have `exp` key (expires in) - any date in the future.
Please read more about JWT tokens: [jwt.io](https://jwt.io).
There are plenty of ready-to-use libraries for most the languages: [jwt.io/libraries](https://jwt.io/libraries).
x-logo:
url: '/logo.svg'
altText: 'Boundless-commerce API'
x-tagGroups:
- name: Catalog
tags:
- Products
- Categories
- Manufacturers
- Product types
- Attributes
- Filters
- Price Types
- name: Files
tags:
- Images
- name: Orders
tags:
- Cart
- Checkout
- Orders
- Manage Orders
- Order Statuses
- name: Users
tags:
- Customers
- Manage Customers
- Customer Groups
- name: System
tags:
- System
tags:
- name: Products
- name: Categories
- name: Manufacturers
- name: Product types
- name: Attributes
- name: Filters
- name: Price Types
- name: Cart
description: >
## How to work with the Cart?
1. Create a cart and save `cart_id` somewhere: `/orders/cart/retrieve`
2. Add items to the cart.
Use `/orders/cart/add` method. You need to submit `cart_id` and `item_id`. The `item_id` is an ID of an item.
Item is a product or a variant (option).
3. Modify the Cart if necessary: Change quantity, remove items, etc: `/orders/cart/{cart_id}/qty`, `/orders/cart/rm-items`.
4. Before moving to checkout you might need to validate items in the cart - if they are in stock and fit the Minimal order amount.
Use `/orders/cart/{cart_id}/validate` method.
5. To start order creation - init the checkout: `/orders/checkout/init` and save `order_id` somewhere. Method creates a draft order.
See Checkout instructions about how to populate order fields.
6. When you are ready to place an order: `/orders/checkout/{order_id}/place`.
**Where I can find item_id ?**
Product's and Variant's responses have an `item_id` field, e.g. `/catalog/products`.
It is important to understand, that if a product has variants - you need to specify variant's `item_id`
(please see explanation for the `/orders/cart/add` method).
**Arbitrary items**
It is possible to add an item which isn't in catalog - an arbitrary item: `/orders/cart/add-custom-item`
- name: Checkout
description: >
## How to work with the Checkout?
1. To init the Checkout process you need an active `cart_id`. Please read [How to work with the Cart first.](#tag/Cart/How-to-work-with-the-Cart)
2. Init the Checkout: `/orders/checkout/init` and save `order.id` somewhere. Method creates a Draft order.
3. Populate Order's fields with `PATCH /orders/checkout/{order_id}/order` method.
4. An alternate way to save contact's information is using `/orders/checkout/{order_id}/contact` method. With this method
customer might be registered as a registered customer.
5. Place an order. There are 2 ways to achieve that: `PATCH /orders/checkout/{order_id}/order` with `place_the_order: true` or
call specific method `POST /orders/checkout/{order_id}/place`
Order will be created and notifications (if set) will be sent.
- name: Orders
- name: Manage Orders
description: >
## Methods for managing orders
**Methods are allowed only for tokens with management rights.**
- name: Order Statuses
- name: Customers
- name: Manage Customers
description: >
## Methods for managing Customers
**Methods are allowed only for tokens with management rights.**
- name: Customer Groups
description: >
## Methods for managing Customer Groups
**Methods are allowed only for tokens with management rights.**
- name: System
- name: Images
servers:
- url: 'https://v1.api.boundless-commerce.com'
paths:
/catalog/products:
get:
tags:
- Products
summary: Get products
parameters:
- in: header
name: X-Customer
schema:
type: string
format: uuid
description: >
Guest user can see only public prices. Logged in customer can see appropriate private prices.
- name: product
in: query
style: form
explode: true
description: >
Products IDs.
Example: `?product[]=1&product[]=2`
schema:
type: array
items:
type: integer
- name: category
in: query
style: form
explode: true
schema:
type: array
items:
type: integer
description: >
Categories IDs.
Example: `?category[]=1&category[]=2`
- name: collection
in: query
style: form
explode: true
schema:
type: array
description: >
Collections IDs.
Example: `?collection[]=1&collection[]=2`
- name: attrs
in: query
explode: true
description: >
Filter by Attributes. Use an Attribute Alias as a key. If an Attribute is a multi-value
(checkbox, select, radio) - the value should be specified as an array.
For multi-value attributes a case ID should be used, e.g.: `?attrs[color][]=622&attrs[color][]=623` - where
`622` and `623` are IDs of cases. To get possible case's values use URL: `/catalog/attributes`
Another way to fetch cases - use filters: `/catalog/filters`. Filters are set of predefined attributes available
for search across catalog.
Example: `?attrs[color][]=622&attrs[color][]=623&props[info]=test`
- name: in_stock
in: query
description: >
Filter by in stock.
schema:
type: string
enum:
- 0
- 1
- name: price_min
in: query
example: 0.01
schema:
type: number
- name: price_max
in: query
example: 5.05
schema:
type: number
- name: brand
in: query
style: form
explode: true
example: brand[]=1&brand[]=2
description: >
Filter by manufacturer(s).
schema:
type: array
items:
type: integer
- name: text_search
in: query
style: form
description: >
Text search in the product title, SKU, and description. Treat it like a "like" search in the database.
schema:
type: string
minLength: 3
maxLength: 20
- name: cross_sell_category
in: query
description: Selecting cross-sell products. "cross_sell_category" and "cross_sell_product" must be specified.
schema:
type: string
enum:
- related
- similar
- name: cross_sell_product
in: query
description: Selecting cross-sell products.
schema:
type: integer
- name: removed
in: query
description: >
Filter by removed products. By default only active (not removed) products are returned.
- `all` - returns all products (active and removed).
- `removed` - returns only removed products.
Whether product was removed or not determined by `deleted_at` field. If a product is removed - `deleted_at` is not null.
schema:
type: string
enum:
- all
- removed
- name: published_status
in: query
description: >
Filter by the Publication status. By default only published products are returned.
- `all` - returns all products (published and hidden).
- `hidden` - returns only hidden products.
Publication status is shown in the `status` field.
- name: sort
in: query
explode: true
description: >
List of sort rules (comma separated).
The direction by default is the `ASC`, for the `DESC` prepare name with a dash "-".
The `in_category` option - sorts products by user's order (user can sort products manually on the admin page).
Examples:
- `?sort=price` - sort by price
- `?sort=-price,name` - sort by price - DESC, name - ASC.`
schema:
type: array
items:
type: string
enum:
- price
- title
- in_category
- in_stock
- in_collection
- cross_sell
- name: page
in: query
description: Page number for the pagination.
schema:
type: integer
- name: per-page
in: query
description: Amounts of products per page. The minimal value is 1, the maximum is 100.
schema:
type: integer
head:
tags:
- Products
summary: Calculate products
description: >
The query parameters is the same as for the `/catalog/products`.
Get pagination headers without actually fetching products. This methods is faster than the `GET`.
**Returns headers:**
- `X-Pagination-Total-Count` - total products
- `X-Pagination-Page-Count` - total pages
- `X-Pagination-Current-Page` - current page
- `X-Pagination-Per-Page` - per page.
Parameters are the same as the GET request.
post:
tags:
- Products
summary: Create a product
description: >
Action allowed only for tokens with management rights.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostProductModel'
required:
- title
/catalog/products/{productId}:
patch:
tags:
- Products
summary: Update a product
description: >
Action allowed only for tokens with management rights.
The method acts like update (not replace) - pass fields which need to be updated.
parameters:
- name: productId
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostProductModel'
/catalog/products/item/{product}:
get:
tags:
- Products
summary: Get detail product
description: >
Fetches a product by ID or slug.
parameters:
- name: product
in: path
required: true
description: >
`product_id` or `slug`.
schema:
oneOf:
- type: integer
- type: string
- in: header
name: X-Customer
schema:
type: string
format: uuid
description: >
Guest user can see only public prices. Logged in customer can see appropriate private prices.
- name: removed
in: query
description: >
Filter by removed products. By default only active (not removed) products are returned.
- `all` - returns all products (active and removed).
- `removed` - returns only removed products.
Whether product was removed or not determined by `deleted_at` field. If a product is removed - `deleted_at` is not null.
schema:
type: string
enum:
- all
- removed
- name: published_status
in: query
description: >
Filter by the Publication status. By default only published products are returned.
- `all` - returns all products (published and hidden).
- `hidden` - returns only hidden products.
Publication status is shown in the `status` field.
/catalog/products/variants:
get:
tags:
- Products
summary: Get variants
description: Fetches variants by product's ID list.
parameters:
- name: product
in: query
required: true
style: form
explode: true
description: >
Example: `?product[]=1&product[]=2`
schema:
type: array
items:
type: integer
/catalog/products/filter-fields-ranges:
post:
tags:
- Filters
summary: Calculate filters summary
description: >
Returns filter's fields with amounts of products per an Attribute Case, Price range, and available manufacturers
(also with amounts of products per manufacturer). Methods also returns detailed information required for building a filter form.
The method is useful to build dynamic catalog filters.
It also takes in account catalog filters and returns the actual product amount per Attribute or Brand.
In the filters `type` = `characteristic` means Attributes. Attributes are former Characteristics.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- filter_fields
properties:
filter_fields:
type: array
items:
type: object
required:
- type
properties:
type:
type: string
enum:
- characteristic
- price
- brand
- availability
characteristic_id:
type: integer
description: Attribute ID
values:
type: object
description: >
Object with filters values. Filters are the same as for the `GET /catalog/products` route.
/catalog/categories/tree:
get:
tags:
- Categories
summary: Get categories as a tree
parameters:
- name: menu
in: query
description: >
Fetches categories are displayed in a menu.
schema:
type: string
enum:
- category
- name: calc_products
in: query
description: >
Shows additional key "products_qty" with amounts of products related to a category.
schema:
type: string
enum:
- 1
/catalog/categories/flat:
get:
tags:
- Categories
summary: Get categories as a flat list
parameters:
- name: menu
in: query
description: >
Fetches categories are displayed in a menu.
schema:
type: string
enum:
- category
- name: calc_products
in: query
description: >
Shows additional key "products_qty" with amounts of products related to a category.
schema:
type: string
enum:
- 1
- name: calc_children
in: query
description: >
Shows additional key "children_qty" with amounts of children related to a category.
schema:
type: string
enum:
- 1
- name: parent
in: query
description: >
Filter list by parent category id. Pass "0" to select root categories.
schema:
type: integer
- name: brand
in: query
description: >
Filter categories that have products related to specific brands.
style: form
explode: true
example: brand[]=1&brand[]=2
schema:
type: array
items:
type: integer
- name: sort
in: query
description: >
Sort categories by a field. The direction by default is the ASC, for the DESC prepare name with a dash "-".
schema:
type: string
enum:
- tree_sort
- title
/catalog/categories/parents:
get:
tags:
- Categories
summary: Get parents as a flat list
parameters:
- name: category
in: query
required: true
schema:
type: integer
/catalog/categories/item/{category}:
get:
tags:
- Categories
summary: Get detail category
parameters:
- name: category
in: path
required: true
description: >
`category_id` or `slug`.
schema:
oneOf:
- type: integer
- type: string
- name: with_children
in: query
description: >
Adds key with children.
schema:
type: string
enum:
- 1
- name: with_siblings
in: query
description: >
Adds key with siblings.
schema:
type: string
enum:
- 1
- name: with_parents
in: query
description: >
Adds key with parents.
schema:
type: string
enum:
- 1
- name: with_filter
in: query
description: >
Adds key with filter.
schema:
type: string
enum:
- 1
/catalog/categories:
post:
tags:
- Categories
summary: Create a category
description: Action allowed only for tokens with management rights.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostCategoryModel'
required:
- title
/catalog/categories/{categoryId}:
patch:
tags:
- Categories
summary: Update a category
description: >
Action allowed only for tokens with management rights.
The method acts like update (not replace) - pass fields which need to be updated.
parameters:
- name: categoryId
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostCategoryModel'
/catalog/manufacturers:
get:
tags:
- Manufacturers
summary: Get manufacturers
parameters:
- name: calc_products
in: query
description: >
Shows additional key "products_qty" with amounts of products related to a manufacturer.
schema:
type: string
enum:
- 1
- name: title
in: query
description: >
Filter manufacturers by title.
schema:
type: string
- name: category
in: query
description: >
Filter manufacturers that have products related to specific categories.
style: form
explode: true
example: category[]=1&category[]=2
schema:
type: array
items:
type: integer
/catalog/manufacturers/{manufacturer}:
get:
tags:
- Manufacturers
summary: Get detail manufacturer
parameters:
- name: manufacturer
in: path
required: true
description: >
`manufacturer_id` or `slug`.
schema:
oneOf:
- type: integer
- type: string
/catalog/product-types:
get:
tags:
- Product types
summary: Get Product types
description: >
Product types are former Commodity Groups. So the ID of a Product type is field `group_id`.
/catalog/product-types/{id}:
get:
tags:
- Product types
summary: Get Product type by ID
description: >
Product types are former Commodity Groups. So the ID of a Product type is field `group_id`.
parameters:
- name: id
in: path
required: true
schema:
type: integer
/catalog/attributes:
get:
tags:
- Attributes
summary: Get Attributes list
description: >
Get a list of all attributes available in the system. Each attribute is related to a Product type
(Product types are former Commodity groups) by field `group_id`. You can filter the result by
passing `group_id=<id>` to select attributes related to particular product type.
parameters:
- name: group_id
in: query
example: 10
schema:
type: integer
- name: id
in: query
style: form
explode: true
example: id[]=1&id[]=2
description: ID(s) of attribute.
schema:
type: array
items:
type: integer
- name: alias
in: query
style: form
explode: true
example: alias[]=color&alias[]=size
schema:
type: array
items:
type: string
post:
tags:
- Attributes
summary: Create an Attribute
description: >
Action allowed only for tokens with management rights.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostCharacteristicModel'
required:
- title
- alias
- group_id
- type
/catalog/attributes/{id}:
get:
tags:
- Attributes
summary: Get an Attribute by ID or Alias
parameters:
- name: id
in: path
required: true
description: >
`id` or `alias`.
schema:
oneOf:
- type: integer
- type: string
patch:
tags:
- Attributes
summary: Update an Attribute
description: >
Action allowed only for tokens with management rights.
The method acts like an update (not replace) - pass fields which needs to be updated.
Fields `group_id` and `type` cannot be updated.
parameters:
- name: id
in: path
required: true
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PostCharacteristicModel'
/catalog/filters:
get:
tags:
- Filters
summary: Get filters
parameters:
- name: is_default
in: query
description: >
Filter by the default field.
schema:
type: string
enum:
- 1
/catalog/filters/{filter_id}:
get:
tags:
- Filters
summary: Get detail filter
parameters:
- name: filter_id
in: path
required: true
schema:
type: integer
/catalog/filters/by-category/{category_id}:
get:
tags:
- Filters
summary: Get filter by category ID
parameters:
- name: category_id
in: path
required: true
schema:
type: integer
/catalog/admin/prices:
get:
tags:
- Price Types
summary: Get Price Types
description: >
**Action allowed only for tokens with management rights.**
/files/images/upload:
post:
tags:
- Images
summary: Upload an image.
description: >
**Action allowed only for tokens with management rights.**
Upload an image for an essence: `product`, `category`, `manufacturer`.
If an image is less than 5mb - you can skip `upload_session_id`, `chunks_number` and `chunk_position`. If an image is
bigger than 5mb - you need to split image by 5mb chunks and pass `upload_session_id`, `chunks_number` and `chunk_position`.
The final file will be concatenated on the final chunk uploads.
**Please take a look at the upload examples**
- [Gist: Simple Upload (no chunks)](https://gist.github.com/kirill-zhirnov/f29e29f7f6bb4dc621dcee3de5138dca)
- [Gist: Upload by chunks](https://gist.github.com/kirill-zhirnov/8778ed3dcb418a1d6818c8a3ea3cbb57)
It is required to pass any of an essence ID: `for_product_id`, `for_category_id` or `for_manufacturer_id`.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- file
- file_name
properties:
file:
type: string
format: binary
file_name:
type: string
upload_session_id:
type: string
format: uuid
description: If a file is being uploaded by chunk - pass `upload_session_id` - the file is concatenating by this ID.
chunks_number:
type: integer
description: If a file is being uploaded by chunk - pass `chunks_number` - the total amount of chunks.
chunk_position:
type: integer
description: If a file is being uploaded by chunk - pass `chunk_position` - the current chunk (starts from 0).
for_product_id:
type: integer