Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

952 righe
22 KiB

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