forked from dylanleclair/databases
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRealbeast API.postman_collection.json
More file actions
2935 lines (2935 loc) · 82.4 KB
/
Realbeast API.postman_collection.json
File metadata and controls
2935 lines (2935 loc) · 82.4 KB
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
{
"info": {
"_postman_id": "4ad1c1f9-5ec6-417b-84db-232a57b7c19e",
"name": "Realbeast API",
"description": "# Introduction\nThe Realbeast API allows for interaction with our systems backend - allowing inventory to be edited, new products to be added, and more. \n\n# Overview\nThings that the developers should know about\n\n# Authentication\nYou will want to use basic authentication with the following login - it should be setup in Postman if you are viewing it from there. \n\n- Username: `admin`\n- Password: `12345`\n\nThe admin cannot be deleted. \n\n# Error Codes\nBad requests are the most often - for example, when you try to access an item that does not exist, it will give you an HTTP 400 / Bad Request.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Product API",
"item": [
{
"name": "Get a list of all products",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
""
]
},
"description": "This is the fastest way to get a preview of all of the products carried across the system, returning a list of all products.\n\nThe ID is included in all get requests, so that subsequent API endpoints can be used."
},
"response": [
{
"name": "Get a list of all products",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Thu, 15 Apr 2021 14:56:54 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, POST, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "1430"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "[\n {\n \"id\": 1,\n \"price\": \"100.00\",\n \"sex\": \"M\",\n \"name\": \"100 Thieves 2020 Jersey\",\n \"description\": \"Support the 100 Thieves with our all new ultrawhite jersey.\",\n \"caption\": \"A preview of the white colourway.\",\n \"img_name\": \"100t-white.jpg\",\n \"brands\": [\n {\n \"brand\": \"100 Thieves\"\n },\n {\n \"brand\": \"Off White\"\n }\n ],\n \"product_types\": [\n {\n \"product_type\": \"Jersey\"\n }\n ],\n \"colors\": [\n {\n \"color\": \"White\"\n }\n ]\n },\n {\n \"id\": 2,\n \"price\": \"115.00\",\n \"sex\": \"U\",\n \"name\": \"100 Thieves Jam Hoodie\",\n \"description\": \"A premium red-black tie dye, every piece has its own personality.\",\n \"caption\": \"A preview of the sweatshirt from the front.\",\n \"img_name\": \"100t-jam.jpg\",\n \"brands\": [\n {\n \"brand\": \"100 Thieves\"\n }\n ],\n \"product_types\": [\n {\n \"product_type\": \"Hoodie\"\n }\n ],\n \"colors\": [\n {\n \"color\": \"Red\"\n },\n {\n \"color\": \"Black\"\n }\n ]\n },\n {\n \"id\": 3,\n \"price\": \"115.00\",\n \"sex\": \"U\",\n \"name\": \"100 Thieves Camping SZN Hoodie\",\n \"description\": \"The No Camping Collection features the most ambitious designs from 100 Thieves yet.\",\n \"caption\": \"A preview of the sweatshirt from the back.\",\n \"img_name\": \"100t-camp.jpg\",\n \"brands\": [],\n \"product_types\": [],\n \"colors\": []\n },\n {\n \"id\": 6,\n \"price\": \"85.00\",\n \"sex\": \"F\",\n \"name\": \"Nike Crater Impact\",\n \"description\": \"Unlike traditional shoe construction, the Nike Crater Impact’s thoughtful and modern design takes pattern efficiency and waste reduction seriously.\",\n \"caption\": \"A preview of the shoe.\",\n \"img_name\": \"crater-impact.jpg\",\n \"brands\": [\n {\n \"brand\": \"Nike\"\n }\n ],\n \"product_types\": [\n {\n \"product_type\": \"Shoe\"\n },\n {\n \"product_type\": \"Lifestyle\"\n }\n ],\n \"colors\": [\n {\n \"color\": \"White\"\n }\n ]\n }\n]"
}
]
},
{
"name": "Update a product's information",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 2,\r\n \"price\": \"130.00\",\r\n \"sex\": \"U\",\r\n \"name\": \"100 Thieves Jam Hoodie\",\r\n \"description\": \"A premium red-black tie dye, every piece has its own personality.\",\r\n \"caption\": \"A preview of the sweatshirt from the front.\",\r\n \"img_name\": \"100t-jam.jpg\",\r\n \"brands\": [\r\n{\"brand\":\"100 Thieves\"}\r\n],\r\n \"product_types\": [\r\n{\"product_type\":\"Hoodie\"}\r\n],\r\n \"colors\": [\r\n{\"color\":\"Red\"},\r\n{\"color\":\"Black\"}\r\n]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/products/2/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"2",
""
]
},
"description": "Updates a product. Supports partial updates.\n\nUpdating a product will clear the brand, product type and color fields."
},
"response": [
{
"name": "Update a product's information",
"originalRequest": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 2,\r\n \"price\": \"115.00\",\r\n \"sex\": \"U\",\r\n \"name\": \"100 Thieves Jam Hoodie\",\r\n \"description\": \"A premium red-black tie dye, every piece has its own personality.\",\r\n \"caption\": \"A preview of the sweatshirt from the front.\",\r\n \"img_name\": \"100t-jam.jpg\",\r\n \"brands\": [\r\n{\"brand\":\"100 Thieves\"}\r\n],\r\n \"product_types\": [\r\n{\"product_type\":\"Hoodie\"}\r\n],\r\n \"colors\": [\r\n{\"color\":\"Red\"},\r\n{\"color\":\"Black\"}\r\n]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/products/2/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"2",
""
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [],
"body": null
}
]
},
{
"name": "Add a new product",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"price\": \"100.00\",\r\n \"sex\": \"F\",\r\n \"name\": \"Nike Crater Impact\",\r\n \"description\": \"Unlike traditional shoe construction, the Nike Crater Impact’s thoughtful and modern design takes pattern efficiency and waste reduction seriously.\",\r\n \"caption\": \"A preview of the sweatshirt from the front.\",\r\n \"img_name\": \"crater-impact.jpg\",\r\n \"brands\": [\r\n{\"brand\":\"Nike\"}\r\n],\r\n \"product_types\": [\r\n{\"product_type\":\"Shoe\"},\r\n{\"product_type\":\"Lifestyle\"}\r\n],\r\n \"colors\": [\r\n{\"color\":\"White\"}\r\n]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/products/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
""
]
},
"description": "Allows for new products to be added. All of the product fields must be filled in for this to succeed."
},
"response": [
{
"name": "Add a new product",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": 6,\r\n \"price\": \"85.00\",\r\n \"sex\": \"F\",\r\n \"name\": \"Nike Crater Impact\",\r\n \"description\": \"Unlike traditional shoe construction, the Nike Crater Impact’s thoughtful and modern design takes pattern efficiency and waste reduction seriously.\",\r\n \"caption\": \"A preview of the sweatshirt from the front.\",\r\n \"img_name\": \"crater-impact.jpg\",\r\n \"brands\": [\r\n{\"brand\":\"Nike\"}\r\n],\r\n \"product_types\": [\r\n{\"product_type\":\"Shoe\"},\r\n{\"product_type\":\"Lifestyle\"}\r\n],\r\n \"colors\": [\r\n{\"color\":\"White\"}\r\n]\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/products/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Thu, 15 Apr 2021 16:24:33 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, POST, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "443"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "{\n \"id\": 7,\n \"price\": \"85.00\",\n \"sex\": \"F\",\n \"name\": \"Nike Crater Impact\",\n \"description\": \"Unlike traditional shoe construction, the Nike Crater Impact’s thoughtful and modern design takes pattern efficiency and waste reduction seriously.\",\n \"caption\": \"A preview of the sweatshirt from the front.\",\n \"img_name\": \"crater-impact.jpg\",\n \"brands\": [\n {\n \"brand\": \"Nike\"\n }\n ],\n \"product_types\": [\n {\n \"product_type\": \"Shoe\"\n },\n {\n \"product_type\": \"Lifestyle\"\n }\n ],\n \"colors\": [\n {\n \"color\": \"White\"\n }\n ]\n}"
}
]
},
{
"name": "Remove a product",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/7/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"7",
""
]
},
"description": "Deletes a product from the system. All other values relying on a product are also deleted by cascading the database."
},
"response": [
{
"name": "Remove a product",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/4/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"4",
""
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [],
"body": null
}
]
},
{
"name": "Get a product",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/<product_id>/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"<product_id>",
""
]
},
"description": "Retrieves information about a specific product. Includes ID for convenience."
},
"response": [
{
"name": "Get a product",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/products/1/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"products",
"1",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Thu, 15 Apr 2021 14:55:31 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, PUT, DELETE, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "348"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "{\n \"id\": 1,\n \"price\": \"100.00\",\n \"sex\": \"M\",\n \"name\": \"100 Thieves 2020 Jersey\",\n \"description\": \"Support the 100 Thieves with our all new ultrawhite jersey.\",\n \"caption\": \"A preview of the white colourway.\",\n \"img_name\": \"100t-white.jpg\",\n \"brands\": [\n {\n \"brand\": \"100 Thieves\"\n },\n {\n \"brand\": \"Off White\"\n }\n ],\n \"product_types\": [\n {\n \"product_type\": \"Jersey\"\n }\n ],\n \"colors\": [\n {\n \"color\": \"White\"\n }\n ]\n}"
}
]
}
],
"description": "The Product API allows products to be created, modified, added and deleted. \n\nThere are a couple examples included for you to try out!\n\nAlmost all of these rely on accessing a product through it's ID. The ID can be found by first querying the list of all products (see examples). The product with the corresponding ID must exist for you to use it.\n\nNote that the image for each product must already exist in the server folder - the example included already has an image, so no need to worry.\n\nEach product has all of the following attributes:\n\n- `id`: the primary key of a product\n- `price`: the price of a product\n- `sex`: the sex the product is defined for- should be \"M\" for male, \"F\" for female and \"U\" for unisex\n- `name`: the name of a product\n- `description`: the description of a product\n- `caption`: the caption of a product, displayed with it's image on the product page\n- `img-name`: the name of the image of the product\n- `brands`: a list of brands associated with the product \n - each brand only contain a \"brand\" field, which can have any value. \n- `product_types`: a list of the product types (shorts, shoes, pants, etc.)\n - each product_type only contain a \"product_type\" field, which can have any value. \n- `colors`: a list of the colors of a product\n - each color only contain a \"color\" field, which can have any value."
},
{
"name": "User API",
"item": [
{
"name": "Get a user",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
},
"description": "This is the first look at the User API, and provides a glance at how users are represented by the API. \n\n-`username`: the primary key of a user (cannot be updated by PUT) \n- `first_name`: the first name of a user\n- `last_name`: the first name of a user\n- `email`: the first name of a user\n- `profile`: the first name of a user (one-to-one relationship with user)\n - `total_rewards`: the rewards points a user has \n - `user_type`: the type of user (\"Customer\", \"Staff\", or \"Owner\")\n - `address`: the address of user\n - `phone_number`: the phone number of user\n - `card_no`: the card_no of user\n \nThe POST request requires some additional attributes to be filled in. See it's documentation for more details"
},
"response": [
{
"name": "Get a user",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 14 Apr 2021 05:19:31 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, POST, PUT, DELETE, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "181"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "{\n \"username\": \"admin\",\n \"first_name\": \"Realbeast\",\n \"last_name\": \"Administrator\",\n \"email\": \"sample@realbeast.ca\",\n \"profile\": {\n \"total_rewards\": 10,\n \"user_type\": \"Staff\",\n \"address\": \"193\",\n \"phone_number\": \"1\",\n \"card_no\": \"0\"\n }\n}"
}
]
},
{
"name": "Update the user",
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"admin\",\r\n \"first_name\": \"Sample\",\r\n \"last_name\": \"Administrator\",\r\n \"email\": \"sample@realbeast.ca\",\r\n \"profile\": {\r\n \"total_rewards\": 60,\r\n \"user_type\": \"Staff\",\r\n \"address\": \"1 University Drive, Calgary AB\",\r\n \"phone_number\": \"403 123 4567\",\r\n \"card_no\": \"1111 1111 1111 1111\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
},
"description": "This will update the logged in User. Since this Postman documentation has the logged in admin user, any changes will be reflected in the above request: 'Get a user'.\n\nThis allows you to partially update the features of a user."
},
"response": [
{
"name": "Update a user",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"admin\",\r\n \"first_name\": \"FirstName\",\r\n \"last_name\": \"LastName\",\r\n \"email\": \"sample@realbeast.ca\",\r\n \"profile\": {\r\n \"total_rewards\": 10,\r\n \"user_type\": \"Staff\",\r\n \"address\": \" 1 University Drive, Calgary AB\",\r\n \"phone_number\": \"403 123 4567\",\r\n \"card_no\": \"1111 1111 1111 1111\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
}
},
"_postman_previewlanguage": null,
"header": null,
"cookie": [],
"body": "{\r\n \"username\": \"admin\",\r\n \"first_name\": \"FirstName\",\r\n \"last_name\": \"LastName\",\r\n \"email\": \"sample@realbeast.ca\",\r\n \"profile\": {\r\n \"total_rewards\": 10,\r\n \"user_type\": \"Staff\",\r\n \"address\": \" 1 University Drive, Calgary AB\",\r\n \"phone_number\": \"403 123 4567\",\r\n \"card_no\": \"1111 1111 1111 1111\"\r\n }\r\n}"
}
]
},
{
"name": "Create a user",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"dylanleclair\",\r\n \"password\": \"12345\",\r\n \"first_name\": \"Dylan\",\r\n \"last_name\": \"Leclair\",\r\n \"email\": \"dylan.leclair1@ucalgary.ca\",\r\n \"is_staff\":\"False\",\r\n \"profile\": {\r\n \"total_rewards\": 0,\r\n \"user_type\": \"Customer\",\r\n \"address\": \"123 Trent St., Calgary AB\",\r\n \"phone_number\": \"403 123 4567\",\r\n \"card_no\": \"1111 1111 1111 1111\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
},
"description": "This request is used to create a new user, and can be performed by any authenticated user. \n\nThe fields for this are a bit different - all must be filled in, with the additional :\n\n- `is_staff`: a boolean attribute, determines whether the user is a staff member or not\n- `password`: the password the user will use to log in"
},
"response": [
{
"name": "Create a user",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"username\": \"dylanleclair\",\r\n \"password\": \"12345\",\r\n \"first_name\": \"Dylan\",\r\n \"last_name\": \"Leclair\",\r\n \"email\": \"dylan.leclair1@ucalgary.ca\",\r\n \"is_staff\":\"False\",\r\n \"profile\": {\r\n \"total_rewards\": 0,\r\n \"user_type\": \"Customer\",\r\n \"address\": \"123 Trent St., Calgary AB\",\r\n \"phone_number\": \"403 123 4567\",\r\n \"card_no\": \"1111 1111 1111 1111\"\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 14 Apr 2021 05:41:22 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, POST, PUT, DELETE, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "254"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": ""
}
]
},
{
"name": "Delete a user",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "username",
"value": "dylanl",
"type": "string"
},
{
"key": "password",
"value": "12345",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
},
"description": "This will delete the user sending the request! Note that deleting the admin is forbidden, and you may receive this as the output of the request, unless you change the user logged in through Postman."
},
"response": [
{
"name": "Delete a user",
"originalRequest": {
"method": "DELETE",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/user/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"user",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Wed, 14 Apr 2021 05:44:19 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, POST, PUT, DELETE, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "25"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "{\n \"res\": \"Object deleted!\"\n}"
}
]
}
],
"description": "The User API has a safe-access approach: the logged in user (all API accesses require authentication) can only modify, retrieve and delete their own user.\n\nUsers can be created at any time, however with the user POST endpoint (see examples)."
},
{
"name": "Order API",
"item": [
{
"name": "Get the logged in user's orders",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/orders/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"orders",
""
]
},
"description": "Returns a list of the orders belonging to the logged in user."
},
"response": [
{
"name": "Get the logged in user's orders",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/orders/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"orders",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Thu, 15 Apr 2021 14:28:23 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Length",
"value": "817"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Referrer-Policy",
"value": "same-origin"
}
],
"cookie": [],
"body": "[\n {\n \"id\": 2,\n \"username\": \"admin\",\n \"location\": \"Online\",\n \"delivery_status\": \"Shipped\",\n \"contains\": [\n {\n \"id\": 5,\n \"product_id\": 2,\n \"quantity\": 1,\n \"size\": \"M\"\n }\n ],\n \"rewards_earned\": 0,\n \"total_price\": \"0.00\",\n \"order_date\": \"2021-04-13T19:19:46.027963-07:00\",\n \"delivery_date\": \"2021-04-18\",\n \"is_restock\": false\n },\n {\n \"id\": 3,\n \"username\": \"admin\",\n \"location\": \"Online\",\n \"delivery_status\": \"Cart\",\n \"contains\": [\n {\n \"id\": 7,\n \"product_id\": 2,\n \"quantity\": 1,\n \"size\": \"L\"\n },\n {\n \"id\": 9,\n \"product_id\": 6,\n \"quantity\": 1,\n \"size\": \"6.5\"\n }\n ],\n \"rewards_earned\": 0,\n \"total_price\": \"0.00\",\n \"order_date\": \"2021-04-13T21:24:47.453207-07:00\",\n \"delivery_date\": \"2021-04-13\",\n \"is_restock\": false\n },\n {\n \"id\": 4,\n \"username\": \"admin\",\n \"location\": \"Online\",\n \"delivery_status\": \"Cart\",\n \"contains\": [],\n \"rewards_earned\": 0,\n \"total_price\": \"0.00\",\n \"order_date\": \"2021-04-13T21:26:42.298778-07:00\",\n \"delivery_date\": \"2021-04-13\",\n \"is_restock\": false\n }\n]"
}
]
},
{
"name": "Get a list of all orders (all users)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/all-orders/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"all-orders",
""
]
},
"description": "Retrieves a list of all orders, system-wide."
},
"response": [
{
"name": "Get a list of all orders (all users)",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "http://127.0.0.1:8000/api/all-orders/",
"protocol": "http",
"host": [
"127",
"0",
"0",
"1"
],
"port": "8000",
"path": [
"api",
"all-orders",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Thu, 15 Apr 2021 14:30:54 GMT"
},
{
"key": "Server",
"value": "WSGIServer/0.2 CPython/3.8.7"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Vary",
"value": "Accept, Cookie"
},
{
"key": "Allow",
"value": "GET, HEAD, OPTIONS"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},