Skip to content
Reece Edwards edited this page Mar 28, 2024 · 12 revisions

API Endpoint Documentation

Overview

The website contains a variety of files pertaining to the API and how its utilized within the website

Table of Contents

API Endpoints

/api/addAdmin

POST to addAdmin This adds a new admin to the database

Requires

  • adminUsername
    • The username of the admin
  • adminPassowrd
    • The password of the admin
  • Token
    • Generated Token from the Admin Panel

Respones N/A

/api/addProduct

POST to addProduct This adds a new product to the database

Requires

  • productName
    • The name of the product
  • productPrice
    • The price of the product
  • productStock
    • The amount of stock of the product
  • productDescription
    • The product description
  • productCategory
    • What category is the product in
  • Token
    • Generated Token from the Admin Panel

Response N/A

/api/AddToken

POST to addToken This adds a new token to the database

Requires

  • tokenName
    • the name of the token
  • tokenAdmin
    • Which admin the token is associated with
  • tokenExp
    • The expiry date of the token
  • `Token"
    • Generated Token from the Admin Panel

Responses

  • 418
    • "Invalid Token"
    • "Error parsing token expiry date"
    • "error creating token"

/api/cancelOrder

POST to cancelOrder cancels a current order

Requires

  • orderID
    • The order ID
  • Token
    • Generated Token from the Admin Panel

Responses

  • 418
    • "The Order ID is not specified"
    • "Error cancelling order"

/api/deleteAdmin

POST to deleteAdmin Deletes an admin from the database

Requires

  • adminID
    • The id of the admin to be deleted
  • Token
    • Generated Token from the Admin Panel

Response

  • 400
    • "Admin ID not specified"
    • "echo $message"

/api/deleteCustomer

POST to deleteCustomer Deletes a customer from the database

Requires

  • Token
    • Generated Token from the Admin Panel
  • customerID
    • The ID of the customer

Response

  • 400
    • "Customer ID not specified"
    • "echo $message"

/api/deleteCustomerReviews

POST to deleteCustomerReviews Deletes all reviews of a certain customer

Requires

  • Token
    • Generated Token from the Admin Panel
  • customerID
    • The ID of the customer

Responses

  • 418
    • Customer ID not specified
    • Error deleting reviews

/api/deleteProduct

POST TO deleteProduct Deletes a product from the database

Requires

  • Token
    • Generated Token from the Admin Panel
  • productID
    • The ID of the product

Responses

  • 400
    • Product ID not specified
    • "echo $message"

/api/deleteProductReviews

POST to deleteProductReviews Deletes all reviews from a certain product

Requires

  • Token
    • Generated Token from the Admin Panel
  • productID
    • The ID of the product

Responses

  • 400
    • Product ID not specified
    • Error deleting reviews

Clone this wiki locally