petstore.swagger.io.json 30 KB

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