swagger.json 28 KB

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