· 6 years ago · Nov 08, 2019, 04:54 AM
1swagger: "2.0"
2info:
3 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."
4 version: "1.0.0"
5 title: "Swagger Petstore"
6 termsOfService: "http://swagger.io/terms/"
7 contact:
8 email: "apiteam@swagger.io"
9 license:
10 name: "Apache 2.0"
11 url: "http://www.apache.org/licenses/LICENSE-2.0.html"
12host: "petstore.swagger.io"
13basePath: "/v2"
14tags:
15- name: "users"
16 description: "task management users"
17- name: "pet"
18 description: "Everything about your Pets"
19 externalDocs:
20 description: "Find out more"
21 url: "http://swagger.io"
22- name: "store"
23 description: "Access to Petstore orders"
24- name: "user"
25 description: "Operations about user"
26 externalDocs:
27 description: "Find out more about our store"
28 url: "http://swagger.io"
29schemes:
30- "https"
31- "http"
32paths:
33 /users:
34 post:
35 tags:
36 - "users"
37 summary: "add a new user"
38 description: ""
39 operationId: "addUser"
40 consumes:
41 - "application/json"
42 - "application/xml"
43 produces:
44 - "application/json"
45 - "application/xml"
46 parameters:
47 - in: "body"
48 name: "body"
49 get:
50 responses:
51 200:
52 description: "success"
53 schema:
54 type: "object"
55 items:
56 $ref: "#/definitions/Users"
57 400:
58 description: "invalid status val"
59 404:
60 description: "user not found"
61 500:
62 description: "internal service error"
63 put:
64 tags:
65 - "users"
66 parameters:
67 - in: "path"
68 type: "integer"
69 name: "uid"
70 description: "asdf"
71 required: true
72 responses:
73 405:
74 description: "Method not allowed"
75
76 delete: X
77 /users/{uid}
78 post: X
79 get:
80 put:
81 delete:
82
83 /users/{uid}/tasks
84 post:
85 get:
86 put: X
87 delete: X
88 /users/{uid}/tasks/{tid}
89 post: X
90 get:
91 put:
92 delete:
93
94
95 /pet:
96 post:
97 tags:
98 - "pet"
99 summary: "Add a new pet to the store"
100 description: ""
101 operationId: "addPet"
102 consumes:
103 - "application/json"
104 - "application/xml"
105 produces:
106 - "application/xml"
107 - "application/json"
108 parameters:
109 - in: "body"
110 name: "body"
111 description: "Pet object that needs to be added to the store"
112 required: true
113 schema:
114 $ref: "#/definitions/Pet"
115 responses:
116 405:
117 description: "Invalid input"
118 security:
119 - petstore_auth:
120 - "write:pets"
121 - "read:pets"
122 put:
123 tags:
124 - "pet"
125 summary: "Update an existing pet"
126 description: ""
127 operationId: "updatePet"
128 consumes:
129 - "application/json"
130 - "application/xml"
131 produces:
132 - "application/xml"
133 - "application/json"
134 parameters:
135 - in: "body"
136 name: "body"
137 description: "Pet object that needs to be added to the store"
138 required: true
139 schema:
140 $ref: "#/definitions/Pet"
141 responses:
142 400:
143 description: "Invalid ID supplied"
144 404:
145 description: "Pet not found"
146 405:
147 description: "Validation exception"
148 security:
149 - petstore_auth:
150 - "write:pets"
151 - "read:pets"
152 /pet/findByStatus:
153 get:
154 tags:
155 - "pet"
156 summary: "Finds Pets by status"
157 description: "Multiple status values can be provided with comma separated strings"
158 operationId: "findPetsByStatus"
159 produces:
160 - "application/xml"
161 - "application/json"
162 parameters:
163 - name: "status"
164 in: "query"
165 description: "Status values that need to be considered for filter"
166 required: true
167 type: "array"
168 items:
169 type: "string"
170 enum:
171 - "available"
172 - "pending"
173 - "sold"
174 default: "available"
175 collectionFormat: "multi"
176 responses:
177 200:
178 description: "successful operation"
179 schema:
180 type: "array"
181 items:
182 $ref: "#/definitions/Pet"
183 400:
184 description: "Invalid status value"
185 security:
186 - petstore_auth:
187 - "write:pets"
188 - "read:pets"
189 /pet/findByTags:
190 get:
191 tags:
192 - "pet"
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 parameters:
200 - name: "tags"
201 in: "query"
202 description: "Tags to filter by"
203 required: true
204 type: "array"
205 items:
206 type: "string"
207 collectionFormat: "multi"
208 responses:
209 200:
210 description: "successful operation"
211 schema:
212 type: "array"
213 items:
214 $ref: "#/definitions/Pet"
215 400:
216 description: "Invalid tag value"
217 security:
218 - petstore_auth:
219 - "write:pets"
220 - "read:pets"
221 deprecated: true
222 /pet/{petId}:
223 get:
224 tags:
225 - "pet"
226 summary: "Find pet by ID"
227 description: "Returns a single pet"
228 operationId: "getPetById"
229 produces:
230 - "application/xml"
231 - "application/json"
232 parameters:
233 - name: "petId"
234 in: "path"
235 description: "ID of pet to return"
236 required: true
237 type: "integer"
238 format: "int64"
239 responses:
240 200:
241 description: "successful operation"
242 schema:
243 $ref: "#/definitions/Pet"
244 400:
245 description: "Invalid ID supplied"
246 404:
247 description: "Pet not found"
248 security:
249 - api_key: []
250 post:
251 tags:
252 - "pet"
253 summary: "Updates a pet in the store with form data"
254 description: ""
255 operationId: "updatePetWithForm"
256 consumes:
257 - "application/x-www-form-urlencoded"
258 produces:
259 - "application/xml"
260 - "application/json"
261 parameters:
262 - name: "petId"
263 in: "path"
264 description: "ID of pet that needs to be updated"
265 required: true
266 type: "integer"
267 format: "int64"
268 - name: "name"
269 in: "formData"
270 description: "Updated name of the pet"
271 required: false
272 type: "string"
273 - name: "status"
274 in: "formData"
275 description: "Updated status of the pet"
276 required: false
277 type: "string"
278 responses:
279 405:
280 description: "Invalid input"
281 security:
282 - petstore_auth:
283 - "write:pets"
284 - "read:pets"
285 delete:
286 tags:
287 - "pet"
288 summary: "Deletes a pet"
289 description: ""
290 operationId: "deletePet"
291 produces:
292 - "application/xml"
293 - "application/json"
294 parameters:
295 - name: "api_key"
296 in: "header"
297 required: false
298 type: "string"
299 - name: "petId"
300 in: "path"
301 description: "Pet id to delete"
302 required: true
303 type: "integer"
304 format: "int64"
305 responses:
306 400:
307 description: "Invalid ID supplied"
308 404:
309 description: "Pet not found"
310 security:
311 - petstore_auth:
312 - "write:pets"
313 - "read:pets"
314 /pet/{petId}/uploadImage:
315 post:
316 tags:
317 - "pet"
318 summary: "uploads an image"
319 description: ""
320 operationId: "uploadFile"
321 consumes:
322 - "multipart/form-data"
323 produces:
324 - "application/json"
325 parameters:
326 - name: "petId"
327 in: "path"
328 description: "ID of pet to update"
329 required: true
330 type: "integer"
331 format: "int64"
332 - name: "additionalMetadata"
333 in: "formData"
334 description: "Additional data to pass to server"
335 required: false
336 type: "string"
337 - name: "file"
338 in: "formData"
339 description: "file to upload"
340 required: false
341 type: "file"
342 responses:
343 200:
344 description: "successful operation"
345 schema:
346 $ref: "#/definitions/ApiResponse"
347 security:
348 - petstore_auth:
349 - "write:pets"
350 - "read:pets"
351 /store/inventory:
352 get:
353 tags:
354 - "store"
355 summary: "Returns pet inventories by status"
356 description: "Returns a map of status codes to quantities"
357 operationId: "getInventory"
358 produces:
359 - "application/json"
360 parameters: []
361 responses:
362 200:
363 description: "successful operation"
364 schema:
365 type: "object"
366 additionalProperties:
367 type: "integer"
368 format: "int32"
369 security:
370 - api_key: []
371 /store/order:
372 post:
373 tags:
374 - "store"
375 summary: "Place an order for a pet"
376 description: ""
377 operationId: "placeOrder"
378 produces:
379 - "application/xml"
380 - "application/json"
381 parameters:
382 - in: "body"
383 name: "body"
384 description: "order placed for purchasing the pet"
385 required: true
386 schema:
387 $ref: "#/definitions/Order"
388 responses:
389 200:
390 description: "successful operation"
391 schema:
392 $ref: "#/definitions/Order"
393 400:
394 description: "Invalid Order"
395 /store/order/{orderId}:
396 get:
397 tags:
398 - "store"
399 summary: "Find purchase order by ID"
400 description: "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions"
401 operationId: "getOrderById"
402 produces:
403 - "application/xml"
404 - "application/json"
405 parameters:
406 - name: "orderId"
407 in: "path"
408 description: "ID of pet that needs to be fetched"
409 required: true
410 type: "integer"
411 maximum: 10.0
412 minimum: 1.0
413 format: "int64"
414 responses:
415 200:
416 description: "successful operation"
417 schema:
418 $ref: "#/definitions/Order"
419 400:
420 description: "Invalid ID supplied"
421 404:
422 description: "Order not found"
423 delete:
424 tags:
425 - "store"
426 summary: "Delete purchase order by ID"
427 description: "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors"
428 operationId: "deleteOrder"
429 produces:
430 - "application/xml"
431 - "application/json"
432 parameters:
433 - name: "orderId"
434 in: "path"
435 description: "ID of the order that needs to be deleted"
436 required: true
437 type: "integer"
438 minimum: 1.0
439 format: "int64"
440 responses:
441 400:
442 description: "Invalid ID supplied"
443 404:
444 description: "Order not found"
445 /user:
446 post:
447 tags:
448 - "user"
449 summary: "Create user"
450 description: "This can only be done by the logged in user."
451 operationId: "createUser"
452 produces:
453 - "application/xml"
454 - "application/json"
455 parameters:
456 - in: "body"
457 name: "body"
458 description: "Created user object"
459 required: true
460 schema:
461 $ref: "#/definitions/User"
462 responses:
463 default:
464 description: "successful operation"
465 /user/createWithArray:
466 post:
467 tags:
468 - "user"
469 summary: "Creates list of users with given input array"
470 description: ""
471 operationId: "createUsersWithArrayInput"
472 produces:
473 - "application/xml"
474 - "application/json"
475 parameters:
476 - in: "body"
477 name: "body"
478 description: "List of user object"
479 required: true
480 schema:
481 type: "array"
482 items:
483 $ref: "#/definitions/User"
484 responses:
485 default:
486 description: "successful operation"
487 /user/createWithList:
488 post:
489 tags:
490 - "user"
491 summary: "Creates list of users with given input array"
492 description: ""
493 operationId: "createUsersWithListInput"
494 produces:
495 - "application/xml"
496 - "application/json"
497 parameters:
498 - in: "body"
499 name: "body"
500 description: "List of user object"
501 required: true
502 schema:
503 type: "array"
504 items:
505 $ref: "#/definitions/User"
506 responses:
507 default:
508 description: "successful operation"
509 /user/login:
510 get:
511 tags:
512 - "user"
513 summary: "Logs user into the system"
514 description: ""
515 operationId: "loginUser"
516 produces:
517 - "application/xml"
518 - "application/json"
519 parameters:
520 - name: "username"
521 in: "query"
522 description: "The user name for login"
523 required: true
524 type: "string"
525 - name: "password"
526 in: "query"
527 description: "The password for login in clear text"
528 required: true
529 type: "string"
530 responses:
531 200:
532 description: "successful operation"
533 schema:
534 type: "string"
535 headers:
536 X-Rate-Limit:
537 type: "integer"
538 format: "int32"
539 description: "calls per hour allowed by the user"
540 X-Expires-After:
541 type: "string"
542 format: "date-time"
543 description: "date in UTC when token expires"
544 400:
545 description: "Invalid username/password supplied"
546 /user/logout:
547 get:
548 tags:
549 - "user"
550 summary: "Logs out current logged in user session"
551 description: ""
552 operationId: "logoutUser"
553 produces:
554 - "application/xml"
555 - "application/json"
556 parameters: []
557 responses:
558 default:
559 description: "successful operation"
560 /user/{username}:
561 get:
562 tags:
563 - "user"
564 summary: "Get user by user name"
565 description: ""
566 operationId: "getUserByName"
567 produces:
568 - "application/xml"
569 - "application/json"
570 parameters:
571 - name: "username"
572 in: "path"
573 description: "The name that needs to be fetched. Use user1 for testing. "
574 required: true
575 type: "string"
576 responses:
577 200:
578 description: "successful operation"
579 schema:
580 $ref: "#/definitions/User"
581 400:
582 description: "Invalid username supplied"
583 404:
584 description: "User not found"
585 put:
586 tags:
587 - "user"
588 summary: "Updated user"
589 description: "This can only be done by the logged in user."
590 operationId: "updateUser"
591 produces:
592 - "application/xml"
593 - "application/json"
594 parameters:
595 - name: "username"
596 in: "path"
597 description: "name that need to be updated"
598 required: true
599 type: "string"
600 - in: "body"
601 name: "body"
602 description: "Updated user object"
603 required: true
604 schema:
605 $ref: "#/definitions/User"
606 responses:
607 400:
608 description: "Invalid user supplied"
609 404:
610 description: "User not found"
611 delete:
612 tags:
613 - "user"
614 summary: "Delete user"
615 description: "This can only be done by the logged in user."
616 operationId: "deleteUser"
617 produces:
618 - "application/xml"
619 - "application/json"
620 parameters:
621 - name: "username"
622 in: "path"
623 description: "The name that needs to be deleted"
624 required: true
625 type: "string"
626 responses:
627 400:
628 description: "Invalid username supplied"
629 404:
630 description: "User not found"
631securityDefinitions:
632 petstore_auth:
633 type: "oauth2"
634 authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
635 flow: "implicit"
636 scopes:
637 write:pets: "modify pets in your account"
638 read:pets: "read your pets"
639 api_key:
640 type: "apiKey"
641 name: "api_key"
642 in: "header"
643
644
645definitions:
646 User:
647 type: "object"
648 properties:
649 uid:
650 type: "integer"
651 format: "int64"
652 first_name:
653 type: "string"
654 format: "string"
655 Task:
656 type: "object"
657 properties:
658 tid:
659 type: "integer"
660 format: "int64"
661 content:
662 type: "string"
663 format: "string"
664
665 Order:
666 type: "object"
667 properties:
668 id:
669 type: "integer"
670 format: "int64"
671 petId:
672 type: "integer"
673 format: "int64"
674 quantity:
675 type: "integer"
676 format: "int32"
677 shipDate:
678 type: "string"
679 format: "date-time"
680 status:
681 type: "string"
682 description: "Order Status"
683 enum:
684 - "placed"
685 - "approved"
686 - "delivered"
687 complete:
688 type: "boolean"
689 default: false
690 xml:
691 name: "Order"
692 Category:
693 type: "object"
694 properties:
695 id:
696 type: "integer"
697 format: "int64"
698 name:
699 type: "string"
700 xml:
701 name: "Category"
702 User:
703 type: "object"
704 properties:
705 id:
706 type: "integer"
707 format: "int64"
708 username:
709 type: "string"
710 firstName:
711 type: "string"
712 lastName:
713 type: "string"
714 email:
715 type: "string"
716 password:
717 type: "string"
718 phone:
719 type: "string"
720 userStatus:
721 type: "integer"
722 format: "int32"
723 description: "User Status"
724 xml:
725 name: "User"
726 Tag:
727 type: "object"
728 properties:
729 id:
730 type: "integer"
731 format: "int64"
732 name:
733 type: "string"
734 xml:
735 name: "Tag"
736 Pet:
737 type: "object"
738 required:
739 - "name"
740 - "photoUrls"
741 properties:
742 id:
743 type: "integer"
744 format: "int64"
745 category:
746 $ref: "#/definitions/Category"
747 name:
748 type: "string"
749 example: "doggie"
750 photoUrls:
751 type: "array"
752 xml:
753 name: "photoUrl"
754 wrapped: true
755 items:
756 type: "string"
757 tags:
758 type: "array"
759 xml:
760 name: "tag"
761 wrapped: true
762 items:
763 $ref: "#/definitions/Tag"
764 status:
765 type: "string"
766 description: "pet status in the store"
767 enum:
768 - "available"
769 - "pending"
770 - "sold"
771 xml:
772 name: "Pet"
773 ApiResponse:
774 type: "object"
775 properties:
776 code:
777 type: "integer"
778 format: "int32"
779 type:
780 type: "string"
781 message:
782 type: "string"
783externalDocs:
784 description: "Find out more about Swagger"
785 url: "http://swagger.io"