Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: "2.0"
- info:
- 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."
- version: "1.0.0"
- title: "Automated Library Management System"
- host: "library.api"
- basePath: "/v1"
- tags:
- - name: "books"
- description: "books related operations"
- schemes:
- - "http"
- securityDefinitions:
- SessionKeyAuth: # arbitrary name for the security scheme
- type: apiKey
- in: header # can be "header", "query" or "cookie"
- name: X-SESSION # name of the header, query parameter or cookie
- paths:
- /login:
- post:
- summary: Logs in and returns the authentication cookie
- consumes:
- - application/json
- parameters:
- - name: loginRequest
- in: body
- description: A JSON object containing the login and password.
- required: true
- schema:
- $ref: '#/definitions/LoginRequest'
- responses:
- 200:
- description: >
- Successfully authenticated.
- The session ID is returned in a cookie named `X-SESSION`. You need to include this cookie in subsequent requests.
- headers:
- Set-Cookie:
- type: string
- description: Set the session token in the cookie
- default: X-SESSION=sessionotkenhere
- /books/{bookId}:
- get:
- tags:
- - "books"
- summary: Lookup book by id
- description: Returns a book dataset.
- parameters:
- - name: "bookId"
- in: "path"
- description: "The book details that needs to be fetched."
- required: true
- type: "string"
- responses:
- 200:
- description: returns a book dataset
- schema:
- $ref: "#/definitions/Book"
- 400:
- description: "Invalid bookdId supplied"
- 404:
- description: "Book not found"
- /books:
- get:
- tags:
- - "books"
- security:
- - SessionKeyAuth: []
- summary: Lookup book by bookTitle
- description: Returns the matching book array
- parameters:
- - name: "bookTitle"
- in: "query"
- description: "The name that needs to be fetched. Use user1 for testing. "
- required: true
- type: "string"
- responses:
- 200:
- description: returns a book array
- schema:
- type: array
- items:
- required:
- - id
- properties:
- bookTitle:
- type: string
- ISBN:
- type: string
- author:
- type: string
- /books/{bookId}/checkout:
- post:
- tags:
- - "books"
- summary: "checkouts a book for the user"
- security:
- - SessionKeyAuth: []
- description: ""
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: "path"
- name: "bookId"
- type: string
- description: "Pet object that needs to be added to the store"
- required: true
- responses:
- 405:
- description: "Invalid input"
- /books/checkout:
- post:
- tags:
- - "books"
- summary: "bulk checkout books for the user"
- description: ""
- security:
- - SessionKeyAuth: []
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: "body"
- name: "body"
- description: "Books object"
- required: true
- schema:
- $ref: "#/definitions/Book"
- responses:
- 405:
- description: "Invalid input"
- /books/{bookId}/checkin:
- post:
- tags:
- - "books"
- summary: "checkouts a book for the user"
- description: ""
- security:
- - SessionKeyAuth: []
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: "path"
- name: "bookId"
- type: string
- description: "Pet object that needs to be added to the store"
- required: true
- responses:
- 405:
- description: "Invalid input"
- /books/checkin:
- post:
- tags:
- - "books"
- security:
- - SessionKeyAuth: []
- summary: "bulk checkout books for the user"
- description: ""
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: "body"
- name: "body"
- description: "Books object"
- required: true
- schema:
- $ref: "#/definitions/Book"
- responses:
- 405:
- description: "Invalid input"
- definitions:
- Book:
- type: "object"
- properties:
- id:
- type: "string"
- ISBN:
- type: "string"
- total_copies:
- type: "integer"
- available_copies:
- type: "integer"
- image_url:
- type: "string"
- author:
- type: "string"
- publisher:
- type: "string"
- category:
- type: "string"
- # A simple username/password combo for logging in
- LoginRequest:
- required: [username, password]
- properties:
- username:
- type: string
- minLength: 1
- password:
- type: string
- minLength: 1
Add Comment
Please, Sign In to add comment