-
Notifications
You must be signed in to change notification settings - Fork 8
API Endpoint
The website contains a variety of files pertaining to the API and how its utilized within the website
-
API EndpointDocumentation- Overview
- Table of Contents
-
API Endpoints
/api/addAdmin/api/addProduct/api/AddToken/api/cancelOrder/api/deleteAdmin/api/deleteCustomer/api/deleteCustomerReviews/api/deleteProduct/api/deleteProductReviews/api/deleteReview/api/editAdmin/api/editCustomer/api/editProduct/api/editReview/api/getAdmin/api/getAllReviews/api/getCustomer/api/getCustomerReviews/api/getProduct/api/getProductReviews/api/refreshToken/api/returnOrder/api/revokeToken/api/updateOrderStatus
POST to addAdmin
This adds a new admin to the database
Requires
-
adminUsername- The username of the admin
-
adminPassword- The password of the admin
-
Token- Generated Token from the Admin Panel
Responses N/A
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
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"
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"
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"
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"
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
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"
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
POST to deleteReview
Deletes a review from a specified product
Requires
-
Token- Generated Token from the Admin Panel
-
productID- The ID of the product
-
customerID- the ID of the customer
Responses
-
418- Customer ID not specified
- Product ID not specified
- Database error deleting review
POST to editAdmin
Edits an existing admin within the database
Requires
-
Token- Generated Token from the Admin Panel
-
adminID- the ID of the admin
-
adminUsername- the username of the admin
-
adminPassword- the password of the admin
Responses N/A
POST to editCustomer
Requires
-
Token- Generated Token from the Admin Panel
-
customerID- The ID of the customer
-
customerUsername- The username of the customer
-
customerEmail- The email of the customer
-
customerAddress- The address of the customer
-
custommerPassword- The password of the customer [misspelt in code]
Responses N/A
POST to editProduct
Edits an existing product on the database
Requires
-
Token- Generated Token from the Admin Panel
-
productID- The product ID
-
productName- The product name
-
productPrice- The product price
-
productStock- The current stock of the product
-
ProductDescription- The description of the product
-
productCategory- The category of the product
Responses N/A
POST to editReview
Edits a specific review for a product
Requires
-
Token- Generated Token from the Admin Panel
-
prodID- The product ID
-
custID- The customer ID
-
rating- The rating for the review
-
review- The review itself
Responses
-
418- Customer ID not specified [Repeated for all variables]
- "echo $err"
POST to getAdmin
Gets a specific admin from the database
Requires
-
Token- Generated Token from the Admin Panel
-
adminID- The ID of the admin
Responses
-
418- adminID not specified
POST to getAllReviews
Gets all the reviews
Requires
-
Token- Generated Token from the Admin Panel
Responses
-
418- Error retrieving reviews
POST to getCustomer
Gets a specific customer
Requires
-
Token- Generated Token from the Admin Panel
-
CustomerID- the ID of the customer
Responses
-
418- customerID not specified
POST to getCustomerReviews
Gets reviews from a specific customer
Requires
-
Token- Generated Token from the Admin Panel
-
customerID- the ID of the customer
Responses
-
418- Customer ID not specified
- Error Retrieving reviews
POST to getProduct
Gets a specific product
Requires
-
Token- Generated Token from the Admin Panel
-
productID- The Product ID
Responses
-
418- productID not specified
POST to getProductReviews
Gets all reviews from a specific product
Requires
-
Token- Generated Token from the Admin Panel
-
productID- The Product ID
Responses
-
418- Product ID not specified
- Error retrieving reviews
POST to refreshToken
Refreshes a specific token
Requires
-
Token- Generated Token from the Admin Panel
Responses
- Invalid token specified
POST to returnOrder
returns a specific order
Requires
-
Token- Generated Token from the Admin Panel
-
OrderID- The specific order ID
Responses
-
418- Order ID not specified
- Error returning order
POST to `revokeToken
Revokes a specific token
Requires
-
Token- Generated Token from the Admin Panel
-
removalToken- The specific token to be revoked
Responses
-
418- removalToken not specified
- Error revoking token
POST to updateOrderStatus
Updates an order status
Requires
-
Token- Generated Token from the Admin Panel
-
orderID- the order ID
-
newStatusID- the new status ID
Responses
-
418- key not specified
-
404- Order not found
-
500- status update failed