Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: '2.0'
- info:
- title: "Book API"
- description: "API | Hypermedia Project Criscuolo-Franzini-Giudici"
- version: "1.0.0"
- # Added by API Auto Mocking Plugin
- host: virtserver.swaggerhub.com
- schemes:
- - https
- tags:
- - name: "Book"
- description: "All about our books"
- - name: "Author"
- description: "All about our authors"
- - name: "User"
- description: "All about our users"
- - name: "Review"
- description: "All about reviews of books"
- - name: "Order"
- description: "All about reviews of orders"
- - name: "Cart"
- description: "All about our carts"
- # basePath: "/api"
- paths:
- '/book':
- get:
- tags:
- - "Book"
- summary: "Get all books"
- operationId: "getBook"
- produces:
- - "application/json"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/findByAuthor':
- get:
- tags:
- - "Book"
- summary: "Get all books by an author"
- operationId: "getBookByAuthor"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: author
- type: string
- required: true
- description: "Author of the books to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/findByDate':
- get:
- tags:
- - "Book"
- summary: "Get all books by pubblication date"
- operationId: "getBookByDate"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: date
- type: string
- format: date
- required: true
- description: "Pubblication Date of the books to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/findByGenre':
- get:
- tags:
- - "Book"
- summary: "Get all books by genre"
- operationId: "getBookByGenre"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: genre
- type: string
- required: true
- description: "Genre of the books to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/findByQuantity':
- get:
- tags:
- - "Book"
- summary: "Get all books by quantity"
- operationId: "getBookByQuantity"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: quantity
- type: number
- format: double
- minimum: 0
- required: true
- description: "Quantity of books"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/findByTitle':
- get:
- tags:
- - "Book"
- summary: "Get all books by title"
- operationId: "getBookByTitle"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: title
- type: string
- required: true
- description: "Title of the books to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/{isbn}':
- get:
- tags:
- - "Book"
- summary: "Get a specific book"
- operationId: "getBookByIsbn"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- post:
- tags:
- - "Book"
- summary: "Post a specific book"
- operationId: "postBookByIsbn"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to insert"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "ISBN of the book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- put:
- tags:
- - "Book"
- summary: "Update a specific book"
- operationId: "putBookByIsbn"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to modify"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- delete:
- tags:
- - "Book"
- summary: "Delete a specific book"
- operationId: "deleteBookByIsbn"
- consumes:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to delete"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "ISBN of the book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/{isbn}/similar':
- get:
- tags:
- - "Book"
- summary: "Get similars book of a specific one"
- operationId: "getSimilarBookByIsbn"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/{isbn}/reviews':
- get:
- tags:
- - "Book"
- summary: "Get reviews of a specific one"
- operationId: "getReviewsBookByIsbn"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/book/{isbn}/UploadImage':
- post:
- tags:
- - "Book"
- summary: "Upload an image of a specific Book"
- operationId: "postBookImage"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: isbn
- type: string
- minLength: 10
- maxLength: 10
- required: true
- description: "ISBN of the book to update"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "ISBN of the book"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/review':
- get:
- tags:
- - "Review"
- summary: "Get all reviews"
- operationId: "getReview"
- produces:
- - "application/json"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- post:
- tags:
- - "Review"
- summary: "Post a review"
- operationId: "postReview"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: user
- type: string
- format: email
- required: true
- description: "User"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "ID of the review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/review/findByBook':
- get:
- tags:
- - "Review"
- summary: "Get all reviews by book"
- operationId: "getReviewByBook"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: book
- type: string
- minLength: 10
- maxLength: 13
- required: true
- description: "Book"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/review/findByUser':
- get:
- tags:
- - "Review"
- summary: "Get all reviews by user"
- operationId: "getReviewByUser"
- produces:
- - "application/json"
- parameters:
- - in: query
- name: user
- type: string
- format: email
- required: true
- description: "User"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/review/{id}':
- get:
- tags:
- - "Review"
- summary: "Get a specific review"
- operationId: "getReviewById"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: id
- type: string
- required: true
- description: "Id of the review to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- put:
- tags:
- - "Review"
- summary: "Update a specific review"
- operationId: "putReviewById"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: id
- type: string
- required: true
- description: "id of the review to modify"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- delete:
- tags:
- - "Review"
- summary: "Delete a specific book"
- operationId: "deleteReviewById"
- consumes:
- - "application/json"
- parameters:
- - in: path
- name: id
- type: string
- required: true
- description: "Id of the review to delete"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "ID of the review"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/user/login':
- post:
- tags:
- - "User"
- summary: "LoginUser"
- description: "Login with a form"
- operationId: "userLoginPOST"
- consumes:
- - "application/x-www-form-urlencoded"
- produces:
- - "application/json"
- parameters:
- - name: "email"
- in: "formData"
- required: true
- type: "string"
- - name: "password"
- in: "formData"
- required: true
- type: "string"
- responses:
- 200:
- description: "successfull login"
- 404:
- description: "unauthorized"
- x-swagger-router-controller: "User"
- '/user/register':
- post:
- tags:
- - "User"
- summary: "RegisterUser"
- description: "Register into the store"
- operationId: "userRegisterPOST"
- consumes:
- - "application/x-www-form-urlencoded"
- produces:
- - "application/json"
- parameters:
- - in: "body"
- name: "body"
- required: true
- schema:
- $ref: "#/definitions/User"
- responses:
- 200:
- description: "successfull registration"
- 404:
- description: "unauthorized"
- x-swagger-router-controller: "User"
- '/user/{email}':
- get:
- tags:
- - "User"
- summary: "Get user with email"
- operationId: "getUser"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the user to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/User"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- post:
- tags:
- - "User"
- summary: "Post a specific user"
- operationId: "postUserByEmail"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the user to insert"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "Email of the user"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- put:
- tags:
- - "User"
- summary: "Update a specific user"
- operationId: "putUserByEmail"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the user to modify"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/User"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- delete:
- tags:
- - "User"
- summary: "Delete a specific user"
- operationId: "deleteUserByEmail"
- consumes:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the user to delete"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "Email of the user"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- '/cart/{email}':
- get:
- tags:
- - "Cart"
- summary: "Get cart with email"
- operationId: "getCart"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the cart to look for"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Cart"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- post:
- tags:
- - "Cart"
- summary: "Post a specific cart"
- operationId: "postCartByEmail"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the cart to insert"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "Email of the user"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- put:
- tags:
- - "Cart"
- summary: "Update a specific cart"
- operationId: "putCartByEmail"
- consumes:
- - "application/json"
- produces:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the cart to modify"
- responses:
- '200':
- description: "OK"
- schema:
- type: "array"
- items:
- $ref: "#/definitions/Cart"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- delete:
- tags:
- - "Cart"
- summary: "Delete a specific cart"
- operationId: "deleteCartByEmail"
- consumes:
- - "application/json"
- parameters:
- - in: path
- name: email
- type: string
- required: true
- description: "Email of the cart to delete"
- responses:
- '200':
- description: "OK"
- schema:
- type: "string"
- description: "Email of the cart"
- '400':
- description: "Bad Request"
- '401':
- description: "Unauthorized"
- '404':
- description: "Not Found"
- definitions:
- Book:
- type: "object"
- properties:
- isbn:
- type: "string"
- minLength: 10
- maxLength: 13
- uniqueItems: true
- title:
- type: "string"
- description:
- type: "string"
- photo:
- type: "string"
- format: "binary"
- author:
- type: "string"
- pubbDate:
- type: "string"
- format: "date"
- bookGenre:
- type: "string"
- similarTo:
- type: "array"
- items:
- type: "string"
- quantity:
- type: "number"
- minimum: 0
- status:
- type: "string"
- enum:
- - "available"
- - "out of stock"
- - "out of production"
- price:
- $ref: "#/definitions/Amount"
- required:
- - isbn
- example:
- isbn: "9788804666639"
- title: "La solitudine dei numeri primi"
- description: "La solitudine dei numeri primi description"
- author: "Paolo Giordano"
- pubbDate: "2016-5-26"
- similarTo: ["9788867024766","9788804606246"]
- quantity: 10
- status: "available"
- price:
- value: 14,00
- currency: "euro"
- Review:
- type: "object"
- properties:
- id:
- type: "string"
- uniqueItems: true
- isbn:
- type: "string"
- minLength: 10
- maxLength: 13
- userId:
- type: "string"
- format: "email"
- title:
- type: "string"
- description:
- type: "string"
- timestamp:
- type: "string"
- format: "date-time"
- required:
- - id
- - isbn
- - userId
- example:
- id: userR001
- isbn: "9788804666639"
- userId: "user@mail.polimi.it"
- title: "Need to be read"
- description: "Beautiful italin book."
- timestamp: "2017-07-21T17:32:28Z"
- User:
- type: "object"
- properties:
- email:
- type: "string"
- format: "email"
- uniqueItems: true
- firstName:
- type: "string"
- lastName:
- type: "string"
- password:
- type: "string"
- format: "password"
- gender:
- type: "string"
- enum: [Female Male]
- birthDay:
- type: "integer"
- format: "date-time"
- userType:
- type: "string"
- enum: [User Admin]
- required:
- - email
- example:
- email: "user@mail.polimi.it"
- firstName: "Mario"
- lastName: "Rossi"
- password: "1234"
- gender: "Female"
- birthDay: "1990-07-21T17:32:28Z"
- userType: "User"
- Cart:
- type: "object"
- properties:
- id:
- type: "string"
- format: "email"
- uniqueItems: true
- total:
- $ref: "#/definitions/Amount"
- books:
- type: "array"
- items:
- $ref: "#/definitions/Book"
- required:
- - id
- example:
- id: "user@mail.polimi.it"
- total:
- value: 14,00
- currency: "euro"
- books:
- isbn: "9788804666639"
- title: "La solitudine dei numeri primi"
- description: "La solitudine dei numeri primi description"
- author: "Paolo Giordano"
- pubbDate: "2016-5-26"
- similarTo: ["9788867024766","9788804606246"]
- quantity: 10
- status: "available"
- price:
- value: 14,00
- currency: "euro"
- Amount:
- type: "object"
- required:
- - "currency"
- - "value"
- properties:
- value:
- type: "number"
- format: "double"
- minimum: 0
- currency:
- $ref: "#/definitions/Currency"
- example:
- value: 11,0
- currency: "euro"
- Currency:
- type: "string"
- enum:
- - "euro"
- - "dollar"
- example: "euro"
- basePath: /MathyasGiudici/Ecommerce/1.0.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement