-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathswagger.yaml
executable file
·1855 lines (1782 loc) · 50.4 KB
/
swagger.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
swagger: '2.0.0'
info:
version: '0.1.4'
title: Facestore API
description: |
This is a reference to Facestore API.
# Introduction
This API is documented in **OpenAPI format** and provided by [facestore.pt](http://facestore.pt) team.
# About the API
Through the Facestore API your applications can retrieve and manage Facestore platform content in your store.
The base address of the API is `https://api.facestore.pt`. There are several endpoints at that address, each with its own unique path.
All endpoints are private and you need the permissions to access them.
To get an API Token you have to be client of Facestore and access your personal account to request it (see the next topic).
# Get API Token
To consume the Facestore API is take the unique token to identify your requests. You can do that accessing the store manager admin and doing the following steps:
1. Go to ``configurations > API`` section.
2. Copy the unique token.
# Requests
The API is based on REST principles: data resources are accessed via standard HTTPS requests in UTF-8 format to an API endpoint. Where possible, the API strives to use appropriate HTTP verbs for each action:
| VERB | DESCRIPTION |
| -------- |:-------------: |
| GET | Used for retrieving resources. |
| POST | Used for creating resources. |
| PUT | Used for changing/replacing resources or collections. |
| PATCH | Used for changing/replacing partial resources. |
| DELETE | Used for deleting resources. |
# Responses
Response Status Codes
The API uses the following response status codes, as defined in the RFC 2616 and RFC 6585:
| STATUS CODE | DESCRIPTION |
|:-----------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| 200 | OK - The request has succeeded. The client can read the result of the request in the body and the headers of the response. |
| 201 | Created - The request has been fulfilled and resulted in a new resource being created. |
| 202 | Accepted - The request has been accepted for processing, but the processing has not been completed. |
| 204 | No Content - The request has succeeded but returns no message body. |
| 304 | Not Modified. See Conditional requests. |
| 400 | Bad Request - The request could not be understood by the server due to malformed syntax. The message body will contain more information; see Error Details. |
| 401 | Unauthorized - The request requires user authentication or, if the request included authorization credentials, authorization has been refused for those credentials. |
| 403 | Forbidden - The server understood the request, but is refusing to fulfill it. |
| 404 | Not Found - The requested resource could not be found. This error can be due to a temporary or permanent condition. |
| 429 | Too Many Requests - Rate limiting has been applied. |
| 500 | Internal Server Error. You should never receive this error because our clever coders catch them all ... but if you are unlucky enough to get one, please report it to us through a comment at the bottom of this page. |
| 502 | Bad Gateway - The server was acting as a gateway or proxy and received an invalid response from the upstream server. |
| 503 | Service Unavailable - The server is currently unable to handle the request due to a temporary condition which will be alleviated after some delay. You can choose to resend the request again. |
# Rate limiting
To make the API fast for everybody, rate limits apply.
Rate limiting is applied on an application basis (based on client id), regardless of how many users are using it.
If you get status code 429, it means that you have sent too many requests. If this happens, have a look in the Retry-After header, where you will see a number displayed. This is the amount of seconds that you need to wait, before you can retry sending your requests.
You can check the returned HTTP headers of any API request to see your current rate limit status:
```
curl -i https://api.facestore.pt/v1/sample
HTTP/1.1 200 OK
Date: Mon, 01 Dec 2016 17:27:06 GMT
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 56
X-RateLimit-Reset: 1372700873
```
The headers tell you everything you need to know about your current rate limit status:
| HEADER NAME | DESCRIPTION |
|:---------------------:|:-------------------------------------------------------------------------------:|
| X-RateLimit-Limit | The maximum number of requests that the consumer is permitted to make per hour. |
| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |
# Timestamps
Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an product is created), an additional field will show the precision; see for example, created_at in an product object.
# Error Details
The API uses the following format to describe unsuccessful responses, return information about the error as an error JSON object containing the following information::
| KEY | VALUE TYPE | VALUE DESCRIPTION |
|:-----------:|:------------:|:-----------------:|
| status_code | integer | The HTTP status code (also returned in the response header; see Response Status Codes for more information). |
| message | string | A short description of the cause of the error. |
x-logo:
url: '../assets/logo.png'
backgroundColor: '#FFFFF'
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
contact:
name: Facestore API team
email: apihelp@facestore.pt
url: http://facestore.pt
host: api.facestore.pt
basePath: /v1
schemes:
- https
consumes:
- application/json
- multipart/form-data
produces:
- application/json
responses:
401:
description: Unauthorized
403:
description: Forbidden
406:
description: Not Acceptable
415:
description: Unsupported Media Type
204:
description: No Content Exist
schema:
type: array
properties:
code:
type: integer
example:
422
message:
type: object
properties:
errors:
type: object
properties:
fields:
type: array
422:
description: Content body error
schema:
type: object
properties:
code:
type: integer
example:
422
message:
type: object
properties:
errors:
type: object
properties:
fields:
type: array
tags:
- name: brands
description: Everything about your Brands
- name: categories
description: Everything about your Categories
- name: customers
description: Everything about your Customers
- name: orders
description: Everything about your Orders
- name: payments
description: Everything about your Payments
- name: products
description: Everything about your Products
- name: products attributes
description: Everything about your Products Attributes
- name: shippings
description: Everything about your Shippings
- name: taxes
description: Everything about your Taxes
paths:
/brands:
get:
tags:
- brands
description: |
Returns all brands from the system that the user has access to
### Includes
You can give the following values on includes parameter: `routes, products`
operationId: getBrands
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Brands response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Brand'
meta:
$ref: '#/definitions/MetaPartialResponse'
204:
$ref: '#/responses/204'
post:
tags:
- brands
description: Creates a new brand in the store.
operationId: addBrands
produces:
- application/json
parameters:
- name: brand
in: body
description: Brand to add to the store
required: true
schema:
$ref: '#/definitions/Brand'
responses:
201:
description: Brand response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Brand'
422:
$ref: '#/responses/422'
/brands/{id}/:
get:
tags:
- brands
description: |
Returns a brand based on a single ID
### Includes
You can give the following values on includea parameter: `routes, products`
operationId: getBrandById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- name: id
in: path
description: ID of brand to fetch
required: true
type: integer
format: int64
responses:
200:
description: Brand response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Brand'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
delete:
tags:
- brands
description: Deletes a single brand based on the ID supplied
operationId: deleteBrandById
parameters:
- name: id
in: path
description: ID of brand to delete
required: true
type: integer
format: int64
responses:
200:
description: Brand has been deleted
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
put:
tags:
- brands
description: Update a single brand based on the ID supplied
operationId: updateBrandsById
parameters:
- name: id
in: path
description: ID of brand to update
required: true
type: integer
format: int64
- name: brand
in: body
description: Brand to update in store
required: true
schema:
type: object
items:
$ref: '#/definitions/Brand'
responses:
200:
description: Brand has been updated
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/brands/{id}/uploads/:
post:
tags:
- brands
summary: Upload de images for brand
operationId: uploadImages
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: id
in: path
description: ID of brand to update
required: true
type: integer
format: int64
- name: image_small
in: formData
description: Small image for brand
type: file
- name: image_large
in: formData
description: Large image for brand
type: file
responses:
200:
description: The images has been uploaded
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/categories:
get:
tags:
- categories
description: |
Returns all categories from the system that the user has access to
### Includes
You can give the following values on includes parameter: `routes, products`
operationId: getCategories
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Category response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Category'
meta:
type: object
properties:
total:
type: string
204:
$ref: '#/responses/204'
post:
tags:
- categories
description: Creates a new category in the store.
operationId: addCategories
produces:
- application/json
parameters:
- name: category
in: body
description: Category to add to the store
required: true
schema:
$ref: '#/definitions/Category'
responses:
201:
description: Category response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Category'
/categories/{id}/:
get:
tags:
- categories
description: |
Returns a category based on a single ID
### Includes
You can give the following values on includes parameter: `routes, products`
operationId: getCategoryById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- name: id
in: path
description: ID of category to fetch
required: true
type: integer
format: int64
responses:
200:
description: Category response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Category'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
delete:
tags:
- categories
description: deletes a single category based on the ID supplied
operationId: deleteCategoryById
parameters:
- name: id
in: path
description: ID of category to delete
required: true
type: integer
format: int64
responses:
200:
description: Category has been deleted
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
put:
tags:
- categories
description: update a single category based on the ID supplied
operationId: updateCategoryById
parameters:
- name: id
in: path
description: ID of category to update
required: true
type: integer
format: int64
- name: category
in: body
description: Category to update in store
required: true
schema:
type: object
items:
$ref: '#/definitions/Category'
responses:
200:
description: Category has been updated
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/categories/{id}/uploads/:
post:
tags:
- categories
summary: Upload de images for category
operationId: uploadImages
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: id
in: path
description: ID of category to update
required: true
type: integer
format: int64
- name: image_small
in: formData
description: Small image for category
type: file
- name: image_large
in: formData
description: Large image for category
type: file
responses:
200:
description: The images has been uploaded
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/attributes:
get:
tags:
- products attributes
description: |
Returns all attributes of products from the system that the user has access to
### Includes
You can give the following values on includes parameter: `options`
operationId: getProductsAttributes
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Attribute response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Attribute'
meta:
$ref: '#/definitions/MetaPartialResponse'
204:
$ref: '#/responses/204'
post:
tags:
- products attributes
description: Creates a new attribute of products in the store.
operationId: addProductsAttributes
produces:
- application/json
parameters:
- name: attribute
in: body
description: Attribute to add to the store
required: true
schema:
$ref: '#/definitions/Attribute'
responses:
201:
description: Attribute response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Brand'
422:
$ref: '#/responses/422'
/attributes/{id}/:
get:
tags:
- products attributes
description: |
Returns a attribute of products based on a single ID
### Includes
You can give the following values on includes parameter: `options`
operationId: getProductAttributeById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- name: id
in: path
description: ID of attribute to fetch
required: true
type: integer
format: int64
responses:
200:
description: Attribute response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Attribute'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
delete:
tags:
- products attributes
description: deletes a single attribute of products based on the ID supplied
operationId: deleteProductAttributeById
parameters:
- name: id
in: path
description: ID of attribute to delete
required: true
type: integer
format: int64
responses:
200:
description: Product Attribute has been deleted
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
put:
tags:
- products attributes
description: update a single attribute of products based on the ID supplied
operationId: updateProductAttributeById
parameters:
- name: id
in: path
description: ID of attribute to update
required: true
type: integer
format: int64
- name: product attribute
in: body
description: Attribute to add to the store
required: true
schema:
type: object
items:
$ref: '#/definitions/Attribute'
responses:
200:
description: Attribute has been updated
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/customers:
get:
tags:
- customers
description: |
Returns all customers from the system that the user has access to
### Includes
You can give the following values on includes parameter: `orders, groups`
operationId: getCustomers
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Customer response
schema:
type: array
items:
$ref: '#/definitions/Customer'
204:
$ref: '#/responses/204'
/customers/{id}/:
get:
tags:
- customers
description: |
Returns all customers from the system that the user has access to
### Includes
You can give the following values on includes parameter: `orders, groups`
operationId: getCustomerById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- name: id
in: path
description: ID of customer
required: true
type: integer
format: int64
responses:
200:
description: Customer response
schema:
type: array
items:
$ref: '#/definitions/Customer'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/orders:
get:
tags:
- orders
description: |
Returns all orders from the system that the user has access to
### Includes
You can give the following values on includes parameter: `products, customers`
operationId: getOrders
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Orders response
schema:
type: array
items:
$ref: '#/definitions/Order'
204:
$ref: '#/responses/204'
/orders/{id}/:
get:
tags:
- orders
description: |
Returns all orders from the system that the user has access to
### Includes
You can give the following values on includes parameter: `products, customers`
operationId: getOrderById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- name: id
in: path
description: ID of customer
required: true
type: integer
format: int64
responses:
200:
description: Orders response
schema:
type: array
items:
$ref: '#/definitions/Order'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/taxes:
get:
tags:
- taxes
description: Returns all taxes from the system that the user has access to
operationId: getTaxes
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
produces:
- application/json
responses:
200:
description: Taxes response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Tax'
meta:
type: object
properties:
total:
type: string
204:
$ref: '#/responses/204'
post:
tags:
- taxes
description: Creates a new tax in the store.
operationId: addTaxes
produces:
- application/json
parameters:
- name: tax
in: body
description: Tax to add to the store
required: true
schema:
$ref: '#/definitions/Tax'
responses:
201:
description: Tax response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Tax'
/taxes/{id}/:
get:
tags:
- taxes
description: Returns a tax based on a single ID
operationId: getTaxById
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- name: id
in: path
description: ID of tax to fetch
required: true
type: integer
format: int64
responses:
200:
description: Taxes response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Tax'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
delete:
tags:
- taxes
description: deletes a single tax based on the ID supplied
operationId: deleteTaxById
parameters:
- name: id
in: path
description: ID of tax to delete
required: true
type: integer
format: int64
responses:
200:
description: Tax has been deleted
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
put:
tags:
- taxes
description: update a single tax based on the ID supplied
operationId: updateTaxById
parameters:
- name: id
in: path
description: ID of tax to update
required: true
type: integer
format: int64
- name: tax
in: body
description: Tax to add to the store
required: true
schema:
$ref: '#/definitions/Tax'
responses:
200:
description: Taxes response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Tax'
404:
description: Resource not found
schema:
type: object
items:
$ref: '#/definitions/NotFoundResponse'
/shippings:
get:
tags:
- shippings
description: Returns all shippings from the system that the user has access to
operationId: getShippings
produces:
- application/json
parameters:
- $ref: '#/parameters/IncludesParam'
- $ref: '#/parameters/LimitParam'
- $ref: '#/parameters/OrderByParam'
responses:
200:
description: Shippings response
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/definitions/Shipping'
meta:
type: object
properties:
total:
type: string
204:
$ref: '#/responses/204'
post:
tags:
- shippings
description: Creates a new shipping in the store.
operationId: addShipping
produces:
- application/json
parameters:
- name: shipping
in: body
description: Shipping to add to the store
required: true
schema:
$ref: '#/definitions/Shipping'
responses:
201:
description: Shipping response
schema:
type: object
properties:
data:
type: array
items: