Advertisement
Guest User

Untitled

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