· 6 years ago · Feb 17, 2020, 08:18 PM
1{
2 "swagger": "2.0",
3 "info": {
4 "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
5 "version": "1.0.0",
6 "title": "Swagger Petstore",
7 "termsOfService": "http://swagger.io/terms/",
8 "contact": {
9 "email": "apiteam@swagger.io"
10 },
11 "license": {
12 "name": "Apache 2.0",
13 "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
14 }
15 },
16 "host": "petstore.swagger.io",
17 "basePath": "/v2",
18 "tags": [
19 {
20 "name": "pet",
21 "description": "Everything about your Pets",
22 "externalDocs": {
23 "description": "Find out more",
24 "url": "http://swagger.io"
25 }
26 },
27 {
28 "name": "store",
29 "description": "Access to Petstore orders"
30 },
31 {
32 "name": "user",
33 "description": "Operations about user",
34 "externalDocs": {
35 "description": "Find out more about our store",
36 "url": "http://swagger.io"
37 }
38 }
39 ],
40 "schemes": [
41 "https",
42 "http"
43 ],
44 "paths": {
45 "/pet": {
46 "post": {
47 "tags": [
48 "pet"
49 ],
50 "summary": "Add a new pet to the store",
51 "description": "",
52 "operationId": "addPet",
53 "consumes": [
54 "application/json",
55 "application/xml"
56 ],
57 "produces": [
58 "application/xml",
59 "application/json"
60 ],
61 "parameters": [
62 {
63 "in": "body",
64 "name": "body",
65 "description": "Pet object that needs to be added to the store",
66 "required": true,
67 "schema": {
68 "$ref": "#/definitions/Pet"
69 }
70 }
71 ],
72 "responses": {
73 "405": {
74 "description": "Invalid input"
75 }
76 },
77 "security": [
78 {
79 "petstore_auth": [
80 "write:pets",
81 "read:pets"
82 ]
83 }
84 ]
85 },
86 "put": {
87 "tags": [
88 "pet"
89 ],
90 "summary": "Update an existing pet",
91 "description": "",
92 "operationId": "updatePet",
93 "consumes": [
94 "application/json",
95 "application/xml"
96 ],
97 "produces": [
98 "application/xml",
99 "application/json"
100 ],
101 "parameters": [
102 {
103 "in": "body",
104 "name": "body",
105 "description": "Pet object that needs to be added to the store",
106 "required": true,
107 "schema": {
108 "$ref": "#/definitions/Pet"
109 }
110 }
111 ],
112 "responses": {
113 "400": {
114 "description": "Invalid ID supplied"
115 },
116 "404": {
117 "description": "Pet not found"
118 },
119 "405": {
120 "description": "Validation exception"
121 }
122 },
123 "security": [
124 {
125 "petstore_auth": [
126 "write:pets",
127 "read:pets"
128 ]
129 }
130 ]
131 }
132 },
133 "/pet/findByStatus": {
134 "get": {
135 "tags": [
136 "pet"
137 ],
138 "summary": "Finds Pets by status",
139 "description": "Multiple status values can be provided with comma separated strings",
140 "operationId": "findPetsByStatus",
141 "produces": [
142 "application/xml",
143 "application/json"
144 ],
145 "parameters": [
146 {
147 "name": "status",
148 "in": "query",
149 "description": "Status values that need to be considered for filter",
150 "required": true,
151 "type": "array",
152 "items": {
153 "type": "string",
154 "enum": [
155 "available",
156 "pending",
157 "sold"
158 ],
159 "default": "available"
160 },
161 "collectionFormat": "multi"
162 }
163 ],
164 "responses": {
165 "200": {
166 "description": "successful operation",
167 "schema": {
168 "type": "array",
169 "items": {
170 "$ref": "#/definitions/Pet"
171 }
172 }
173 },
174 "400": {
175 "description": "Invalid status value"
176 }
177 },
178 "security": [
179 {
180 "petstore_auth": [
181 "write:pets",
182 "read:pets"
183 ]
184 }
185 ]
186 }
187 },
188 "/pet/findByTags": {
189 "get": {
190 "tags": [
191 "pet"
192 ],
193 "summary": "Finds Pets by tags",
194 "description": "Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
195 "operationId": "findPetsByTags",
196 "produces": [
197 "application/xml",
198 "application/json"
199 ],
200 "parameters": [
201 {
202 "name": "tags",
203 "in": "query",
204 "description": "Tags to filter by",
205 "required": true,
206 "type": "array",
207 "items": {
208 "type": "string"
209 },
210 "collectionFormat": "multi"
211 }
212 ],
213 "responses": {
214 "200": {
215 "description": "successful operation",
216 "schema": {
217 "type": "array",
218 "items": {
219 "$ref": "#/definitions/Pet"
220 }
221 }
222 },
223 "400": {
224 "description": "Invalid tag value"
225 }
226 },
227 "security": [
228 {
229 "petstore_auth": [
230 "write:pets",
231 "read:pets"
232 ]
233 }
234 ],
235 "deprecated": true
236 }
237 },
238 "/pet/{petId}": {
239 "get": {
240 "tags": [
241 "pet"
242 ],
243 "summary": "Find pet by ID",
244 "description": "Returns a single pet",
245 "operationId": "getPetById",
246 "produces": [
247 "application/xml",
248 "application/json"
249 ],
250 "parameters": [
251 {
252 "name": "petId",
253 "in": "path",
254 "description": "ID of pet to return",
255 "required": true,
256 "type": "integer",
257 "format": "int64"
258 }
259 ],
260 "responses": {
261 "200": {
262 "description": "successful operation",
263 "schema": {
264 "$ref": "#/definitions/Pet"
265 }
266 },
267 "400": {
268 "description": "Invalid ID supplied"
269 },
270 "404": {
271 "description": "Pet not found"
272 }
273 },
274 "security": [
275 {
276 "api_key": []
277 }
278 ]
279 },
280 "post": {
281 "tags": [
282 "pet"
283 ],
284 "summary": "Updates a pet in the store with form data",
285 "description": "",
286 "operationId": "updatePetWithForm",
287 "consumes": [
288 "application/x-www-form-urlencoded"
289 ],
290 "produces": [
291 "application/xml",
292 "application/json"
293 ],
294 "parameters": [
295 {
296 "name": "petId",
297 "in": "path",
298 "description": "ID of pet that needs to be updated",
299 "required": true,
300 "type": "integer",
301 "format": "int64"
302 },
303 {
304 "name": "name",
305 "in": "formData",
306 "description": "Updated name of the pet",
307 "required": false,
308 "type": "string"
309 },
310 {
311 "name": "status",
312 "in": "formData",
313 "description": "Updated status of the pet",
314 "required": false,
315 "type": "string"
316 }
317 ],
318 "responses": {
319 "405": {
320 "description": "Invalid input"
321 }
322 },
323 "security": [
324 {
325 "petstore_auth": [
326 "write:pets",
327 "read:pets"
328 ]
329 }
330 ]
331 },
332 "delete": {
333 "tags": [
334 "pet"
335 ],
336 "summary": "Deletes a pet",
337 "description": "",
338 "operationId": "deletePet",
339 "produces": [
340 "application/xml",
341 "application/json"
342 ],
343 "parameters": [
344 {
345 "name": "api_key",
346 "in": "header",
347 "required": false,
348 "type": "string"
349 },
350 {
351 "name": "petId",
352 "in": "path",
353 "description": "Pet id to delete",
354 "required": true,
355 "type": "integer",
356 "format": "int64"
357 }
358 ],
359 "responses": {
360 "400": {
361 "description": "Invalid ID supplied"
362 },
363 "404": {
364 "description": "Pet not found"
365 }
366 },
367 "security": [
368 {
369 "petstore_auth": [
370 "write:pets",
371 "read:pets"
372 ]
373 }
374 ]
375 }
376 },
377 "/pet/{petId}/uploadImage": {
378 "post": {
379 "tags": [
380 "pet"
381 ],
382 "summary": "uploads an image",
383 "description": "",
384 "operationId": "uploadFile",
385 "consumes": [
386 "multipart/form-data"
387 ],
388 "produces": [
389 "application/json"
390 ],
391 "parameters": [
392 {
393 "name": "petId",
394 "in": "path",
395 "description": "ID of pet to update",
396 "required": true,
397 "type": "integer",
398 "format": "int64"
399 },
400 {
401 "name": "additionalMetadata",
402 "in": "formData",
403 "description": "Additional data to pass to server",
404 "required": false,
405 "type": "string"
406 },
407 {
408 "name": "file",
409 "in": "formData",
410 "description": "file to upload",
411 "required": false,
412 "type": "file"
413 }
414 ],
415 "responses": {
416 "200": {
417 "description": "successful operation",
418 "schema": {
419 "$ref": "#/definitions/ApiResponse"
420 }
421 }
422 },
423 "security": [
424 {
425 "petstore_auth": [
426 "write:pets",
427 "read:pets"
428 ]
429 }
430 ]
431 }
432 },
433 "/store/inventory": {
434 "get": {
435 "tags": [
436 "store"
437 ],
438 "summary": "Returns pet inventories by status",
439 "description": "Returns a map of status codes to quantities",
440 "operationId": "getInventory",
441 "produces": [
442 "application/json"
443 ],
444 "parameters": [],
445 "responses": {
446 "200": {
447 "description": "successful operation",
448 "schema": {
449 "type": "object",
450 "additionalProperties": {
451 "type": "integer",
452 "format": "int32"
453 }
454 }
455 }
456 },
457 "security": [
458 {
459 "api_key": []
460 }
461 ]
462 }
463 },
464 "/store/order": {
465 "post": {
466 "tags": [
467 "store"
468 ],
469 "summary": "Place an order for a pet",
470 "description": "",
471 "operationId": "placeOrder",
472 "produces": [
473 "application/xml",
474 "application/json"
475 ],
476 "parameters": [
477 {
478 "in": "body",
479 "name": "body",
480 "description": "order placed for purchasing the pet",
481 "required": true,
482 "schema": {
483 "$ref": "#/definitions/Order"
484 }
485 }
486 ],
487 "responses": {
488 "200": {
489 "description": "successful operation",
490 "schema": {
491 "$ref": "#/definitions/Order"
492 }
493 },
494 "400": {
495 "description": "Invalid Order"
496 }
497 }
498 }
499 },
500 "/store/order/{orderId}": {
501 "get": {
502 "tags": [
503 "store"
504 ],
505 "summary": "Find purchase order by ID",
506 "description": "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions",
507 "operationId": "getOrderById",
508 "produces": [
509 "application/xml",
510 "application/json"
511 ],
512 "parameters": [
513 {
514 "name": "orderId",
515 "in": "path",
516 "description": "ID of pet that needs to be fetched",
517 "required": true,
518 "type": "integer",
519 "maximum": 10,
520 "minimum": 1,
521 "format": "int64"
522 }
523 ],
524 "responses": {
525 "200": {
526 "description": "successful operation",
527 "schema": {
528 "$ref": "#/definitions/Order"
529 }
530 },
531 "400": {
532 "description": "Invalid ID supplied"
533 },
534 "404": {
535 "description": "Order not found"
536 }
537 }
538 },
539 "delete": {
540 "tags": [
541 "store"
542 ],
543 "summary": "Delete purchase order by ID",
544 "description": "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors",
545 "operationId": "deleteOrder",
546 "produces": [
547 "application/xml",
548 "application/json"
549 ],
550 "parameters": [
551 {
552 "name": "orderId",
553 "in": "path",
554 "description": "ID of the order that needs to be deleted",
555 "required": true,
556 "type": "integer",
557 "minimum": 1,
558 "format": "int64"
559 }
560 ],
561 "responses": {
562 "400": {
563 "description": "Invalid ID supplied"
564 },
565 "404": {
566 "description": "Order not found"
567 }
568 }
569 }
570 },
571 "/user": {
572 "post": {
573 "tags": [
574 "user"
575 ],
576 "summary": "Create user",
577 "description": "This can only be done by the logged in user.",
578 "operationId": "createUser",
579 "produces": [
580 "application/xml",
581 "application/json"
582 ],
583 "parameters": [
584 {
585 "in": "body",
586 "name": "body",
587 "description": "Created user object",
588 "required": true,
589 "schema": {
590 "$ref": "#/definitions/User"
591 }
592 }
593 ],
594 "responses": {
595 "default": {
596 "description": "successful operation"
597 }
598 }
599 }
600 },
601 "/user/createWithArray": {
602 "post": {
603 "tags": [
604 "user"
605 ],
606 "summary": "Creates list of users with given input array",
607 "description": "",
608 "operationId": "createUsersWithArrayInput",
609 "produces": [
610 "application/xml",
611 "application/json"
612 ],
613 "parameters": [
614 {
615 "in": "body",
616 "name": "body",
617 "description": "List of user object",
618 "required": true,
619 "schema": {
620 "type": "array",
621 "items": {
622 "$ref": "#/definitions/User"
623 }
624 }
625 }
626 ],
627 "responses": {
628 "default": {
629 "description": "successful operation"
630 }
631 }
632 }
633 },
634 "/user/createWithList": {
635 "post": {
636 "tags": [
637 "user"
638 ],
639 "summary": "Creates list of users with given input array",
640 "description": "",
641 "operationId": "createUsersWithListInput",
642 "produces": [
643 "application/xml",
644 "application/json"
645 ],
646 "parameters": [
647 {
648 "in": "body",
649 "name": "body",
650 "description": "List of user object",
651 "required": true,
652 "schema": {
653 "type": "array",
654 "items": {
655 "$ref": "#/definitions/User"
656 }
657 }
658 }
659 ],
660 "responses": {
661 "default": {
662 "description": "successful operation"
663 }
664 }
665 }
666 },
667 "/user/login": {
668 "get": {
669 "tags": [
670 "user"
671 ],
672 "summary": "Logs user into the system",
673 "description": "",
674 "operationId": "loginUser",
675 "produces": [
676 "application/xml",
677 "application/json"
678 ],
679 "parameters": [
680 {
681 "name": "username",
682 "in": "query",
683 "description": "The user name for login",
684 "required": true,
685 "type": "string"
686 },
687 {
688 "name": "password",
689 "in": "query",
690 "description": "The password for login in clear text",
691 "required": true,
692 "type": "string"
693 }
694 ],
695 "responses": {
696 "200": {
697 "description": "successful operation",
698 "schema": {
699 "type": "string"
700 },
701 "headers": {
702 "X-Rate-Limit": {
703 "type": "integer",
704 "format": "int32",
705 "description": "calls per hour allowed by the user"
706 },
707 "X-Expires-After": {
708 "type": "string",
709 "format": "date-time",
710 "description": "date in UTC when token expires"
711 }
712 }
713 },
714 "400": {
715 "description": "Invalid username/password supplied"
716 }
717 }
718 }
719 },
720 "/user/logout": {
721 "get": {
722 "tags": [
723 "user"
724 ],
725 "summary": "Logs out current logged in user session",
726 "description": "",
727 "operationId": "logoutUser",
728 "produces": [
729 "application/xml",
730 "application/json"
731 ],
732 "parameters": [],
733 "responses": {
734 "default": {
735 "description": "successful operation"
736 }
737 }
738 }
739 },
740 "/user/{username}": {
741 "get": {
742 "tags": [
743 "user"
744 ],
745 "summary": "Get user by user name",
746 "description": "",
747 "operationId": "getUserByName",
748 "produces": [
749 "application/xml",
750 "application/json"
751 ],
752 "parameters": [
753 {
754 "name": "username",
755 "in": "path",
756 "description": "The name that needs to be fetched. Use user1 for testing. ",
757 "required": true,
758 "type": "string"
759 }
760 ],
761 "responses": {
762 "200": {
763 "description": "successful operation",
764 "schema": {
765 "$ref": "#/definitions/User"
766 }
767 },
768 "400": {
769 "description": "Invalid username supplied"
770 },
771 "404": {
772 "description": "User not found"
773 }
774 }
775 },
776 "put": {
777 "tags": [
778 "user"
779 ],
780 "summary": "Updated user",
781 "description": "This can only be done by the logged in user.",
782 "operationId": "updateUser",
783 "produces": [
784 "application/xml",
785 "application/json"
786 ],
787 "parameters": [
788 {
789 "name": "username",
790 "in": "path",
791 "description": "name that need to be updated",
792 "required": true,
793 "type": "string"
794 },
795 {
796 "in": "body",
797 "name": "body",
798 "description": "Updated user object",
799 "required": true,
800 "schema": {
801 "$ref": "#/definitions/User"
802 }
803 }
804 ],
805 "responses": {
806 "400": {
807 "description": "Invalid user supplied"
808 },
809 "404": {
810 "description": "User not found"
811 }
812 }
813 },
814 "delete": {
815 "tags": [
816 "user"
817 ],
818 "summary": "Delete user",
819 "description": "This can only be done by the logged in user.",
820 "operationId": "deleteUser",
821 "produces": [
822 "application/xml",
823 "application/json"
824 ],
825 "parameters": [
826 {
827 "name": "username",
828 "in": "path",
829 "description": "The name that needs to be deleted",
830 "required": true,
831 "type": "string"
832 }
833 ],
834 "responses": {
835 "400": {
836 "description": "Invalid username supplied"
837 },
838 "404": {
839 "description": "User not found"
840 }
841 }
842 }
843 }
844 },
845 "securityDefinitions": {
846 "petstore_auth": {
847 "type": "oauth2",
848 "authorizationUrl": "http://petstore.swagger.io/oauth/dialog",
849 "flow": "implicit",
850 "scopes": {
851 "write:pets": "modify pets in your account",
852 "read:pets": "read your pets"
853 }
854 },
855 "api_key": {
856 "type": "apiKey",
857 "name": "api_key",
858 "in": "header"
859 }
860 },
861 "definitions": {
862 "Order": {
863 "type": "object",
864 "properties": {
865 "id": {
866 "type": "integer",
867 "format": "int64"
868 },
869 "petId": {
870 "type": "integer",
871 "format": "int64"
872 },
873 "quantity": {
874 "type": "integer",
875 "format": "int32"
876 },
877 "shipDate": {
878 "type": "string",
879 "format": "date-time"
880 },
881 "status": {
882 "type": "string",
883 "description": "Order Status",
884 "enum": [
885 "placed",
886 "approved",
887 "delivered"
888 ]
889 },
890 "complete": {
891 "type": "boolean",
892 "default": false
893 }
894 },
895 "xml": {
896 "name": "Order"
897 }
898 },
899 "Category": {
900 "type": "object",
901 "properties": {
902 "id": {
903 "type": "integer",
904 "format": "int64"
905 },
906 "name": {
907 "type": "string"
908 }
909 },
910 "xml": {
911 "name": "Category"
912 }
913 },
914 "User": {
915 "type": "object",
916 "properties": {
917 "id": {
918 "type": "integer",
919 "format": "int64"
920 },
921 "username": {
922 "type": "string"
923 },
924 "firstName": {
925 "type": "string"
926 },
927 "lastName": {
928 "type": "string"
929 },
930 "email": {
931 "type": "string"
932 },
933 "password": {
934 "type": "string"
935 },
936 "phone": {
937 "type": "string"
938 },
939 "userStatus": {
940 "type": "integer",
941 "format": "int32",
942 "description": "User Status"
943 }
944 },
945 "xml": {
946 "name": "User"
947 }
948 },
949 "Tag": {
950 "type": "object",
951 "properties": {
952 "id": {
953 "type": "integer",
954 "format": "int64"
955 },
956 "name": {
957 "type": "string"
958 }
959 },
960 "xml": {
961 "name": "Tag"
962 }
963 },
964 "Pet": {
965 "type": "object",
966 "required": [
967 "name",
968 "photoUrls"
969 ],
970 "properties": {
971 "id": {
972 "type": "integer",
973 "format": "int64"
974 },
975 "category": {
976 "$ref": "#/definitions/Category"
977 },
978 "name": {
979 "type": "string",
980 "example": "doggie"
981 },
982 "photoUrls": {
983 "type": "array",
984 "xml": {
985 "name": "photoUrl",
986 "wrapped": true
987 },
988 "items": {
989 "type": "string"
990 }
991 },
992 "tags": {
993 "type": "array",
994 "xml": {
995 "name": "tag",
996 "wrapped": true
997 },
998 "items": {
999 "$ref": "#/definitions/Tag"
1000 }
1001 },
1002 "status": {
1003 "type": "string",
1004 "description": "pet status in the store",
1005 "enum": [
1006 "available",
1007 "pending",
1008 "sold"
1009 ]
1010 }
1011 },
1012 "xml": {
1013 "name": "Pet"
1014 }
1015 },
1016 "ApiResponse": {
1017 "type": "object",
1018 "properties": {
1019 "code": {
1020 "type": "integer",
1021 "format": "int32"
1022 },
1023 "type": {
1024 "type": "string"
1025 },
1026 "message": {
1027 "type": "string"
1028 }
1029 }
1030 }
1031 },
1032 "externalDocs": {
1033 "description": "Find out more about Swagger",
1034 "url": "http://swagger.io"
1035 }
1036}