petstore.swagger.io.json 33 KB

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