-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.json
1764 lines (1764 loc) · 80.3 KB
/
swagger.json
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",
"info": {
"version": "1.0.0",
"title": "SpottyThings",
"description": "API documentation for SpottyThings",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"host": "progettot25-production.up.railway.app",
"basePath": "/",
"tags": [
{
"name": "Utente",
"description": "API per il modello 'Utente'. Tutte le API per gestire le azioni relative agli utenti."
},
{
"name" : "Autenticazione",
"description": "API per gestire login e logout e gestione del token"
},
{
"name" : "Annuncio",
"description": "API per il modello 'Annuncio'. Tutte le API per gestire le azioni relative agli annunci."
},
{
"name" : "Transazione",
"description": "API per il modello 'Transazione'. Tutte le API per gestire le azioni relative alle transazioni."
},
{
"name" : "Recensione",
"description": "API per il modello 'Recensione'. Tutte le API per gestire le azioni relative alle recensioni."
},
{
"name" : "Profilo",
"description" : "API per il modello 'Profilo'. Tutte le API per gestire le azioni relative alle attività sul sito degli utenti, salvate nel loro profilo."
},
{
"name" : "Gestore mail",
"description" : "API per gestire l'invio di email a un indirizzo specificato."
}
],
"schemes": ["https", "http"],
"consumes": ["application/json"],
"produces": ["application/json"],
"paths": {
"/api/u/signUp" : {
"post" : {
"tags" : ["Utente"],
"summary" : "Usata per salvare un nuovo utente nel sistema.",
"responses" : {
"201" : {
"description" : "CREATED. Utente creato correttamente."
},
"409" : {
"description" : "CONFLICT. Errore in seguito all'inserimento di uno username o di un indirizzo email già occupato da un altro utente."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [{
"in" : "body",
"name" : "Dati utente",
"description" : "Le informazioni sul nuovo utente da creare",
"schema" : {
"type" : "object",
"required" : ["nome", "cognome", "username", "datadinascita", "indirizzo", "email", "password"],
"properties" : {
"nome" : {
"type" : "string",
"example" : "Mario"
},
"cognome" : {
"type" : "string",
"example" : "Rossi"
},
"datadinascita" : {
"type" : "string",
"example" : "1969-03-17"
},
"indirizzo" : {
"type" : "string",
"example" : "via Sommarive 20, Povo, Trento"
},
"email" : {
"type" : "string",
"example" : "[email protected]"
},
"username" : {
"type" : "string",
"example" : "marioRossi17"
},
"password" : {
"type" : "string",
"example" : "Password123?"
},
"metodiPagamento" : {
"type" : "string",
"summary" : "L'eventuale indirizzo mail del conto PayPal a cui associare il proprio account per i pagamenti online",
"example" : "[email protected]"
}
}
}
}]
}
},
"/api/u/deleteu/{username}" : {
"delete" : {
"tags" : ["Utente"],
"summary" : "Usata per eliminare un utente identificato da un preciso username.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Utente eliminato correttamente e nessun ritorno dalla API."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato come parametro."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "username",
"in" : "path",
"description" : "Username dell'utente da eliminare."
},
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
}
]
}
},
"/api/u/getAll" : {
"get" : {
"tags" : [
"Utente"
],
"summary": "Usata per ottenere tutti gli utenti registrati al sistema.",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli utenti registrati."
},
"404" : {
"description" : "NOT FOUND. Nessun utente nel sistema."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
}
}
},
"/api/u/getu/{username}" : {
"get" : {
"tags" : [
"Utente"
],
"summary": "Usata per ottenere una precisa risorsa utente associata al preciso username passato.",
"responses" : {
"200" : {
"description" : "OK. Si ottiene il preciso utente associato allo username passato come parametro."
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato come parametro."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{"name" : "username",
"in" : "path",
"description" : "Username dell'utente da ricercare."
}
]
}
},
"/api/u/updateu/" : {
"patch" : {
"tags" : [
"Utente"
],
"summary": "Usata per aggiornare le informazioni di un utente, identificato da uno username che viene passato nel body.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Utente aggiornato correttamente e nessun ritorno dalla API."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato nel body."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
},
{
"in" : "body",
"name" : "Dati utente",
"description" : "Le informazioni da aggiornare su un utente.",
"schema" : {
"type" : "object",
"required" : ["username"],
"properties" : {
"nome" : {
"type" : "string",
"example" : "Paolo"
},
"cognome" : {
"type" : "string",
"example" : "Verdi"
},
"datadinascita" : {
"type" : "string",
"example" : "1974-01-04"
},
"indirizzo" : {
"type" : "string",
"example" : "via Rosimini 25, Trento, Trento"
},
"metodiPagamento" : {
"type" : "string",
"summary" : "L'indirizzo mail del conto PayPal a cui associare il proprio account per i pagamenti online",
"example" : "[email protected]"
},
"username" : {
"type" : "string",
"example" : "marioRossi17"
}
}
}
}]
}
},
"/api/u/updatee/" : {
"patch" : {
"tags" : [
"Utente"
],
"summary": "Usata per aggiornare l'indirizzo email di un utente, identificato da uno username che viene passato nel body.",
"responses" : {
"200" : {
"description" : "OK. Si ritorna un messaggio di nessuna modifica effettuata se si inserisce lo stesso indirizzo email già salvato."
},
"204" : {
"description" : "NO CONTENT. Indirizzo mail aggiornato correttamente e nessun ritorno dalla API."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato nel body."
},
"409" : {
"description" : "CONFLICT. Errore in seguito all'inserimento di un indirizzo email già associato a un utente."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
},
{
"in" : "body",
"name" : "Email da modificare",
"description" : "Le informazioni da aggiornare su un utente.",
"schema" : {
"type" : "object",
"required" : ["username"],
"properties" : {
"username" : {
"type" : "string",
"example" : "marioRossi17"
},
"email" : {
"type" : "string",
"example" : "[email protected]"
}
}
}
}]
}
},
"/api/u/updatep/" : {
"patch" : {
"tags" : [
"Utente"
],
"summary": "Usata per aggiornare la password di un utente, identificato da uno username che viene passato nel body.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Password aggiornata correttamente e nessun ritorno dalla API."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato nel body."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
},
{
"in" : "body",
"name" : "Password da modificare",
"description" : "Le informazioni da aggiornare su un utente.",
"schema" : {
"type" : "object",
"required" : ["username"],
"properties" : {
"username" : {
"type" : "string",
"example" : "marioRossi17"
},
"password" : {
"type" : "string",
"example" : "Password123!"
}
}
}
}]
}
},
"/api/a/savea" : {
"post" : {
"tags" : ["Annuncio"],
"summary" : "Usata per salvare un nuovo annuncio nel sistema.",
"responses" : {
"201" : {
"description" : "CREATED. Annuncio creato correttamente."
},
"400" : {
"description" : "BAD REQUEST. Errore nella formulazione della richiesta in seguito a incongruenze tra i dati (ad esempio pagamento online abilitato ma conto no)."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Inserzionista specificato non presente nel database."
},
"409" : {
"description" : "CONFLICT. Errore in seguito al tentativo di creare un annuncio con un titolo già presente."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
},
{
"in" : "body",
"name" : "Dati annuncio",
"description" : "Le informazioni sul nuovo annuncio da creare",
"schema" : {
"type" : "object",
"required" : ["inserzionista", "titolo", "modalitaTransizione", "categoria"],
"properties" : {
"titolo" : {
"type" : "string",
"example" : "Libro 'Promessi Sposi'"
},
"inserzionista" : {
"type" : "string",
"example" : "marioRossi17"
},
"descrizione" : {
"type" : "string",
"example" : "Libro in ottime condizioni de i 'Promessi Sposi'. Qualche piega in alcune pagine, ma niente di compromettente. Disponibilità della spedizione."
},
"via" : {
"type" : "string",
"example" : "via Rosmini 15"
},
"citta" : {
"type" : "string",
"example" : "Rovereto"
},
"provincia" : {
"type" : "string",
"example" : "Trento"
},
"modalitaTransazione" : {
"type" : "string",
"summary" : "'Affitto' o 'Vendita'",
"example" : "Vendita"
},
"categoria" : {
"type" : "string",
"example" : "hobby"
},
"pagamentoOnline" : {
"type" : "boolean",
"example" : "true",
"summary" : "Assume valore 'true' o 'false' a seconda se si abilita o meno il pagamento online"
},
"contoPayPal" : {
"type" : "string",
"example" : "[email protected]",
"summary" : "Da specificare se si intende permettere il pagamento online"
},
"sponsorizzato" : {
"type" : "boolean",
"example" : "false",
"summary" : "Possibilità di avere il proprio annuncio tra i primi risultati di ricerca"
},
"prezzo" : {
"type" : "number",
"example" : 25.50,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Affitto'"
},
"prezzoAffittoAlGiorno" : {
"type" : "number",
"example" : 5.50,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
},
"prezzoAffittoAllOra" : {
"type" : "number",
"example" : 7.50,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
},
"prezzoAffittoSettimanale" : {
"type" : "number",
"example" : 11.50,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
}
}
}
}]
}
},
"/api/a/getAll" : {
"get" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ottenere tutti gli annunci presenti nel sistema.",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli annunci nel sistema."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
}
}
},
"/api/a/geti/{id}" : {
"get" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ottenere l'annuncio associato a un preciso titolo.",
"responses" : {
"200" : {
"description" : "OK. Si ottiene correttamente l'annuncio che ha il titolo specificato."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema con il titolo specificato."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "id",
"in" : "path",
"description" : "Titolo dell'annuncio da ricercare."
}
]
}
},
"/api/a/getau/{inserzionista}" : {
"get" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ottenere tutti gli annunci postati da un preciso utente.",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli annunci ordinati dell'utente specificato."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema associato all'utente specificato."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "inserzionista",
"in" : "path",
"description" : "Username dell'utente di cui ricercare gli annunci."
}
]
}
},
"/api/a/getaf" : {
"post" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ottenere tutti gli annunci in base a particolari filtri passati nel body. Se non si vuole specificare un filtro, omettere il corrispondente campo nel body!",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli annunci che soddisfano i filtri di ricerca."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema oppure nessun annuncio che soddisfa i filtri impostati."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [{
"in" : "body",
"name" : "Filtri applicati",
"description" : "Filtri di ricerca per gli annunci.\nIMPORTANTE: se non si vuole specificare un filtro, omettere il corrispondente campo nel body!",
"schema" : {
"type" : "object",
"properties" : {
"categoria" : {
"type" : "string",
"example" : "sport"
},
"transazione" : {
"type" : "string",
"example" : "Vendita"
},
"pagamentoOnline" : {
"type" : "boolean",
"example" : "true"
},
"provincia" : {
"type" : "string",
"example" : "Trento"
},
"citta" : {
"type" : "string",
"example" : "Trento"
},
"startPrice" : {
"type" : "number",
"example" : 5
},
"endPrice" : {
"type" : "number",
"example" : 100
},
"startDate" : {
"type" : "string",
"example" : "2022-06-20"
},
"endDate" : {
"type" : "string",
"example" : "2022-12-10"
}
}
}
}]
}
},
"/api/a/getkt/{word}" : {
"get" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ottenere tutti gli annunci che contengono una parola chiave nel titolo (non si fanno distinzioni tra maiuscole e minuscole).",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli annunci che presentano nel titolo la keyword specificata."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema oppure nessun annuncio che soddisfa la keyowrd ricercata."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "word",
"in" : "path",
"description" : "Parola chiave specificata che deve essere contenuta nel titolo di un annuncio."
}
]
}
},
"/api/a/ordina/{p}" : {
"post" : {
"tags" : ["Annuncio"],
"summary" : "Usata per ordinare un array di annunci passato nel body secondo un ordinamento specifico.",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutti gli annunci ordinati come richiesto."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema."
}
},
"parameters" : [
{
"name" : "p",
"in" : "path",
"description" : "Valore che specifica l'ordinamento desiderato. Possibili valori di 'p': \n'd1': data di pubblicazione crescente.\n'd2': data di pubblicazione decrescente.\n'm1': prezzo crescente.\n'm2': prezzo decrescente."
},
{
"in" : "body",
"name" : "Elenco di annunci",
"description" : "Array di annunci che saranno poi ordinati",
"schema" : {
"type" : "object",
"properties" : {
"arrayAnnunci" : {
"type" : "array",
"example" : "[{\"_id\":\"Scarpe da basket\",\"inserzionista\":\"marioRossi17\",\"titolo\":\"Scarpe da basket\",\"descrizione\":\"Scarpe sportive taglia 43\",\"dataPubblicazione\":\"2022-11-06T00:00:00.000Z\",\"modalitaTransazione\":\"Vendita\",\"categoria\":\"sport\",\"indirizzoRitiro\":\"{\\\"via\\\":\\\"via Rosimini 64\\\",\\\"citta\\\":\\\"Trento\\\",\\\"provincia\\\":\\\"Trento\\\"}\",\"pagamentoOnline\":false,\"contoPayPal\":\"[email protected]\",\"visibile\":true,\"sponsorizzato\":false,\"prezzo\":54.2,\"__v\":0}, {\"_id\":\"Cacciavite\",\"inserzionista\":\"fede\",\"titolo\":\"Cacciavite\",\"descrizione\":\"Cacciavite a stella nuovo.\",\"dataPubblicazione\":\"2022-12-19T00:00:00.000Z\",\"modalitaTransazione\":\"Affitto\",\"categoria\":\"fai da te\",\"indirizzoRitiro\":\"{\\\"via\\\":\\\"via cacciatora 23\\\",\\\"citta\\\":\\\"povo\\\",\\\"provincia\\\":\\\"trento\\\"}\",\"pagamentoOnline\":false,\"visibile\":true,\"sponsorizzato\":false,\"prezzoAffittoAlGiorno\":45,\"prezzoAffittoSettimanale\":45,\"prezzoAffittoAllOra\":45,\"__v\":0}]"
}
}
}
}
]
}
},
"/api/a/updatea" : {
"patch" : {
"tags" : ["Annuncio"],
"summary" : "Usata per modificare i dati di un annuncio, il cui titolo identificativo viene passato nel body insieme ai dati da modificare.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Annuncio modificato correttamente e nessun ritorno dalla API."
},
"400" : {
"description" : "BAD REQUEST. Errore nella formulazione della richiesta in seguito a incongruenze tra i dati (ad esempio pagamento online abilitato ma conto no)."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema con il titolo specificato."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "x-access-token",
"description" : "token d'accesso",
"in" : "header"
},{
"in" : "body",
"name" : "Dati annuncio",
"description" : "Le informazioni sul nuovo annuncio da creare.\nIMPORTANTE: omettere dalla richiesta i campi che non si vogliono modificare.",
"schema" : {
"type" : "object",
"required" : ["titolo"],
"properties" : {
"titolo" : {
"type" : "string",
"example" : "Libro 'Promessi Sposi'"
},
"descrizione" : {
"type" : "string",
"example" : "Libro in ottime condizioni de i 'Promessi Sposi'. Qualche piega in alcune pagine, ma niente di compromettente."
},
"via" : {
"type" : "string",
"example" : "via Rosmini 15"
},
"citta" : {
"type" : "string",
"example" : "Trento"
},
"provincia" : {
"type" : "string",
"example" : "Trento"
},
"modalitaTransazione" : {
"type" : "string",
"example" : "Affitto",
"summary" : "'Affitto' o 'Vendita'"
},
"categoria" : {
"type" : "string",
"example" : "hobby"
},
"pagamentoOnline" : {
"type" : "boolean",
"example" : false,
"summary" : "Assume valore 'true' o 'false' a seconda se si abilita o meno il pagamento online"
},
"contoPayPal" : {
"type" : "string",
"summary" : "Da specificare se si intende permettere il pagamento online"
},
"sponsorizzato" : {
"type" : "boolean",
"example" : true,
"summary" : "Possibilità di avere il proprio annuncio tra i primi risultati di ricerca"
},
"visibile" : {
"type" : "boolean",
"example" : true,
"summary" : "Per rendere l'annuncio privato o pubblico"
},
"prezzo" : {
"type" : "number",
"example": 10.50,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Affitto'"
},
"prezzoAffittoAlGiorno" : {
"type" : "number",
"example" : 5.15,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
},
"prezzoAffittoAllOra" : {
"type" : "number",
"example" : 10.15,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
},
"prezzoAffittoSettimanale" : {
"type" : "number",
"example" : 15.15,
"summary" : "Campo che viene omesso se 'modalitaTransazione' è impostata su 'Vendita'"
}
}
}
}]
}
},
"/api/a/deletea/{id}" : {
"delete" : {
"tags" : ["Annuncio"],
"summary" : "Usata per cancellare un preciso annuncio, il cui titolo viene specificato come parametro.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Annuncio eliminato correttamente e nessun ritorno dalla API."
},
"404" : {
"description" : "NOT FOUND. Nessun annuncio nel sistema con il titolo specificato."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "id",
"in" : "path",
"description" : "Titolo dell'annuncio da eliminare."
}
]
}
},
"/api/l/signIn" : {
"post" : {
"tags" : ["Autenticazione"],
"summary" : "Usata per verificare il corretto matchin username-password in fase di login. Si occupa anche di generare il token d'accesso della durata di 12 ore.",
"responses" : {
"200" : {
"description" : "OK. Si ottiene un messaggio di conferma relativo al corretto login oltre che il token d'accesso associato e lo username dell'utente appena autenticato."
},
"400" : {
"description" : "BAD REQUEST. Username o password dell'utente non corrette."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [{
"in" : "body",
"name" : "Dati per il login",
"description" : "Lo username e la password da verificare.",
"schema" : {
"type" : "object",
"properties" : {
"username" : {
"type" : "string",
"example" : "marioRossi17"
},
"password" : {
"type" : "string",
"example" : "Password123?"
}
}
}
}]
}
},
"/api/l/logout" : {
"get" : {
"tags" : ["Autenticazione"],
"summary" : "Usata per gestire la richiesta di logout dell'utente: si occupa di disabilitare il token d'accesso.",
"responses" : {
"200" : {
"description" : "OK. Si ottiene un messaggio di conferma relativo al corretto logout effettuato."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato nel body."
}
},
"parameters" : [
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
}
]
}
},
"/api/l/ripristino" : {
"post" : {
"tags" : ["Autenticazione"],
"summary" : "Usata dal sistema per ripristinare la password dell'utente in caso di dimenticanza. Questa API modifica con una stringa di 10 caratteri casuali la password dell'utente, poi con un'altra API si invierà una mail con il contenuto della nuova password.",
"responses" : {
"204" : {
"description" : "NO CONTENT. Password modificata correttamente e nessun ritorno dalla API."
},
"404" : {
"description" : "NOT FOUND. Nessun utente associato allo username passato nel body."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"in" : "body",
"name" : "Dati utente",
"description" : "Lo username dell'utente di cui ripristinare la password",
"schema" : {
"type" : "object",
"properties" : {
"username" : {
"type" : "string",
"example" :"marioRossi17"
}
}
}
}]
}
},
"/api/t/savet" : {
"post" : {
"tags" : ["Transazione"],
"summary" : "Usata per salvare una nuova transazione nel sistema.",
"responses" : {
"201" : {
"description" : "CREATED. Transazione creata correttamente."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Errore nel caso in cui l'utente acquirente non esiste oppure l'annuncio per cui si vuol fare la transazione non esiste oppure l'utente venditore specificato non è associato ad un suo annuncio."
},
"409" : {
"description" : "CONFLICT. Errore in seguito al tentativo di salvare una transazione già salvata."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
},
"parameters" : [
{
"name" : "x-access-token",
"in" : "header",
"description" : "token d'accesso"
},
{
"in" : "body",
"name" : "Dati transazione",
"description" : "Le informazioni sulla nuova transazione da creare",
"schema" : {
"type" : "object",
"required" : ["venditore", "acquirente", "prodotto", "metodoTransazione", "price"],
"properties" : {
"venditore" : {
"type" : "string",
"example" :"marioRossi17"
},
"acquirente" : {
"type" : "string",
"example" :"paoloVerdi19"
},
"prodotto" : {
"type" : "string",
"summary" : "Il titolo dell'annuncio.",
"example" : "Libro 'Promessi Sposi'"
},
"pagamentoEffettuato" : {
"type" : "boolean",
"default" : "true"
},
"dataTransazione" : {
"type" : "string",
"summary" : "Formato: yyyy-mm-dd! Si mette default la data del giorno di creazione della recensione",
"default" : "Data corrente"
},
"metodoTransazione" : {
"type" : "string",
"summary" : "'Online' oppure 'Di persona'",
"example" : "Online"
},
"price" : {
"type" : "number",
"summary" : "Importo della transazione",
"example" : "150"
}
}
}
}]
}
},
"/api/t/getAll" : {
"get" : {
"tags" : ["Transazione"],
"summary" : "Usata per ottenere tutte le transazioni presenti nel sistema.",
"responses" : {
"200" : {
"description" : "OK. Si ottengono correttamente tutte le transazioni nel sistema."
},
"404" : {
"description" : "NOT FOUND. Nessuna transazione nel sistema."
},
"500" : {
"description" : "SERVER ERROR. Di varia natura."
}
}
}
},
"/api/t/gettv/{venditore}" : {
"get" : {
"tags" : ["Transazione"],
"summary" : "Usata per ottenere le transazioni in uscita di un utente.",
"responses" : {
"200" : {
"description" : "OK. Si ottiene l'elenco delle transazioni in uscita per l'utente specificato."
},
"401" : {
"description" : "UNAUTHORIZED. Token non fornito, impossibile autorizzare la richiesta."
},
"403" : {
"description" : "FORBIDDEN. Token fornito non valido, impossibile autorizzare la richiesta. Si prega di rieffettuare il login"
},
"404" : {
"description" : "NOT FOUND. Nessuna transazione in uscita per l'utente specificato."
},