Advertisement
Guest User

Untitled

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