Guest User

Untitled

a guest
Nov 10th, 2017
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 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: "Automated Library Management System"
  6.  
  7. host: "library.api"
  8. basePath: "/v1"
  9. tags:
  10. - name: "books"
  11. description: "books related operations"
  12. schemes:
  13. - "http"
  14.  
  15. securityDefinitions:
  16. SessionKeyAuth: # arbitrary name for the security scheme
  17. type: apiKey
  18. in: header # can be "header", "query" or "cookie"
  19. name: X-SESSION # name of the header, query parameter or cookie
  20.  
  21. paths:
  22. /login:
  23. post:
  24. summary: Logs in and returns the authentication cookie
  25. consumes:
  26. - application/json
  27. parameters:
  28. - name: loginRequest
  29. in: body
  30. description: A JSON object containing the login and password.
  31. required: true
  32. schema:
  33. $ref: '#/definitions/LoginRequest'
  34. responses:
  35. 200:
  36. description: >
  37. Successfully authenticated.
  38. The session ID is returned in a cookie named `X-SESSION`. You need to include this cookie in subsequent requests.
  39. headers:
  40. Set-Cookie:
  41. type: string
  42. description: Set the session token in the cookie
  43. default: X-SESSION=sessionotkenhere
  44.  
  45. /books/{bookId}:
  46. get:
  47. tags:
  48. - "books"
  49. summary: Lookup book by id
  50. description: Returns a book dataset.
  51. parameters:
  52. - name: "bookId"
  53. in: "path"
  54. description: "The book details that needs to be fetched."
  55. required: true
  56. type: "string"
  57. responses:
  58. 200:
  59. description: returns a book dataset
  60. schema:
  61. $ref: "#/definitions/Book"
  62. 400:
  63. description: "Invalid bookdId supplied"
  64. 404:
  65. description: "Book not found"
  66. /books:
  67. get:
  68. tags:
  69. - "books"
  70. security:
  71. - SessionKeyAuth: []
  72. summary: Lookup book by bookTitle
  73. description: Returns the matching book array
  74. parameters:
  75. - name: "bookTitle"
  76. in: "query"
  77. description: "The name that needs to be fetched. Use user1 for testing. "
  78. required: true
  79. type: "string"
  80. responses:
  81. 200:
  82. description: returns a book array
  83. schema:
  84. type: array
  85. items:
  86. required:
  87. - id
  88. properties:
  89. bookTitle:
  90. type: string
  91. ISBN:
  92. type: string
  93. author:
  94. type: string
  95.  
  96. /books/{bookId}/checkout:
  97. post:
  98. tags:
  99. - "books"
  100. summary: "checkouts a book for the user"
  101. security:
  102. - SessionKeyAuth: []
  103. description: ""
  104. consumes:
  105. - "application/json"
  106. produces:
  107. - "application/json"
  108. parameters:
  109. - in: "path"
  110. name: "bookId"
  111. type: string
  112. description: "Pet object that needs to be added to the store"
  113. required: true
  114. responses:
  115. 405:
  116. description: "Invalid input"
  117. /books/checkout:
  118. post:
  119. tags:
  120. - "books"
  121. summary: "bulk checkout books for the user"
  122. description: ""
  123. security:
  124. - SessionKeyAuth: []
  125. consumes:
  126. - "application/json"
  127. produces:
  128. - "application/json"
  129. parameters:
  130. - in: "body"
  131. name: "body"
  132. description: "Books object"
  133. required: true
  134. schema:
  135. $ref: "#/definitions/Book"
  136. responses:
  137. 405:
  138. description: "Invalid input"
  139.  
  140. /books/{bookId}/checkin:
  141. post:
  142. tags:
  143. - "books"
  144. summary: "checkouts a book for the user"
  145. description: ""
  146. security:
  147. - SessionKeyAuth: []
  148. consumes:
  149. - "application/json"
  150. produces:
  151. - "application/json"
  152. parameters:
  153. - in: "path"
  154. name: "bookId"
  155. type: string
  156. description: "Pet object that needs to be added to the store"
  157. required: true
  158. responses:
  159. 405:
  160. description: "Invalid input"
  161. /books/checkin:
  162. post:
  163. tags:
  164. - "books"
  165. security:
  166. - SessionKeyAuth: []
  167. summary: "bulk checkout books for the user"
  168. description: ""
  169. consumes:
  170. - "application/json"
  171. produces:
  172. - "application/json"
  173. parameters:
  174. - in: "body"
  175. name: "body"
  176. description: "Books object"
  177. required: true
  178. schema:
  179. $ref: "#/definitions/Book"
  180. responses:
  181. 405:
  182. description: "Invalid input"
  183.  
  184.  
  185. definitions:
  186. Book:
  187. type: "object"
  188. properties:
  189. id:
  190. type: "string"
  191. ISBN:
  192. type: "string"
  193. total_copies:
  194. type: "integer"
  195. available_copies:
  196. type: "integer"
  197. image_url:
  198. type: "string"
  199. author:
  200. type: "string"
  201. publisher:
  202. type: "string"
  203. category:
  204. type: "string"
  205. # A simple username/password combo for logging in
  206. LoginRequest:
  207. required: [username, password]
  208. properties:
  209. username:
  210. type: string
  211. minLength: 1
  212. password:
  213. type: string
  214. minLength: 1
Add Comment
Please, Sign In to add comment