openapi: 3.0.3 info: title: 'Laravel REST API' description: 'A simple REST API in Laravel' version: 1.0.0 servers: - url: 'https://rest.iankumu.com' paths: /api/v1/login: post: summary: Login operationId: login description: 'This endpoint is used to login a user to the system.' parameters: - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 200: description: 'Successful Login' content: application/json: schema: type: object example: message: 'User Login Successfully' access_token: 8|MgowQLkdpShwrb8AI9j1YAGmwnDjAOeE17XrP5nb token_type: Bearer properties: message: type: string example: 'User Login Successfully' access_token: type: string example: 8|MgowQLkdpShwrb8AI9j1YAGmwnDjAOeE17XrP5nb token_type: type: string example: Bearer 401: description: 'Failed Login' content: application/json: schema: type: object example: message: 'Invalid login credentials' properties: message: type: string example: 'Invalid login credentials' tags: - Authentication requestBody: required: true content: application/json: schema: type: object properties: email: type: string description: '' example: ian@gmail.com password: type: string description: '' example: '12345678' required: - email - password security: [] /api/v1/register: post: summary: Register operationId: register description: 'This endpoint is used to register a new user to the database.' parameters: - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 201: description: 'User Account Created' content: application/json: schema: type: object example: message: 'User Account Created Successfully' access_token: 8|MgowQLkdpShwrb8AI9j1YAGmwnDjAOeE17XrP5nb token_type: Bearer properties: message: type: string example: 'User Account Created Successfully' access_token: type: string example: 8|MgowQLkdpShwrb8AI9j1YAGmwnDjAOeE17XrP5nb token_type: type: string example: Bearer tags: - Authentication requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: '' example: Ian email: type: string description: '' example: ian@gmail.com password: type: string description: '' example: '12345678' required: - name - email - password security: [] /api/v1/logout: post: summary: Logout operationId: logout description: 'This endpoint is used to logout a user from the system.' parameters: - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 200: description: 'Successful Logout' content: application/json: schema: type: object example: message: 'Succesfully Logged out' properties: message: type: string example: 'Succesfully Logged out' tags: - Authentication /api/v1/products: get: summary: 'Get All Products' operationId: getAllProducts description: 'This endpoint is used to fetch all products available in the database.' parameters: - in: query name: page description: 'The page number from pagination. Defaut is ''1''' example: 1 required: false schema: type: integer description: 'The page number from pagination. Defaut is ''1''' example: 1 - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 200: description: 'Get All Products' content: application/json: schema: type: object example: data: - id: 1 product_name: quo product_price: $15 discounted_price: $13.5 discount: $1.5 product_description: 'Ut rerum aut deleniti eveniet ad et ullam perferendis.' - id: 2 product_name: Laptop product_price: $500 discounted_price: $450 discount: $50 product_description: 'This is a brand new laptop' properties: data: type: array example: - id: 1 product_name: quo product_price: $15 discounted_price: $13.5 discount: $1.5 product_description: 'Ut rerum aut deleniti eveniet ad et ullam perferendis.' - id: 2 product_name: Laptop product_price: $500 discounted_price: $450 discount: $50 product_description: 'This is a brand new laptop' items: type: object tags: - Products post: summary: 'Add Products to the Database' operationId: addProductsToTheDatabase description: 'This endpoint is used to add a product to the database.' parameters: - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 201: description: 'Add a Product' content: application/json: schema: type: object example: data: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' properties: data: type: object example: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' tags: - Products requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: '' example: Laptop price: type: number description: '' example: 199.0 description: type: string description: '' example: 'Nulla voluptas cumque illum iure nulla.' required: - name - price - description '/api/v1/products/{id}': get: summary: 'Get a Single Product' operationId: getASingleProduct description: 'This endpoint is used to return a single products from the database.' parameters: - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 200: description: 'Get a Single Product' content: application/json: schema: type: object example: data: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' properties: data: type: object example: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' tags: - Products put: summary: 'Update Product Details' operationId: updateProductDetails description: 'This endpoint is used to update a product''s details.' parameters: - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 200: description: 'Update a Product' content: application/json: schema: type: object example: data: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' properties: data: type: object example: id: 2 product_name: veritatis product_price: $30 discounted_price: $27 discount: $3 product_description: 'Esse cupiditate eaque qui laboriosam quis id.' tags: - Products requestBody: required: true content: application/json: schema: type: object properties: name: type: string description: '' example: Laptop price: type: number description: '' example: 199.0 description: type: string description: '' example: 'Non aperiam quia consequatur a facere sapiente.' required: - name - price - description delete: summary: 'Delete a Product' operationId: deleteAProduct description: 'This endpoint is used to delete a product from the database.' parameters: - in: header name: Authorization description: '' example: 'Bearer ' schema: type: string - in: header name: Content-Type description: '' example: application/json schema: type: string - in: header name: Accept description: '' example: application/json schema: type: string responses: 204: description: 'Delete a Product' tags: - Products parameters: - in: path name: id description: 'The ID of the product.' example: 8 required: true schema: type: integer tags: - name: Authentication description: "\nAPIs for User Authentication" - name: Products description: "\nAPIs for managing Products" components: securitySchemes: default: type: http scheme: bearer description: '' security: - default: []