Advertisement
Guest User

Untitled

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