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