This is simple rest api for a store named Gorkhali.
- gorkhali_store/api/config contains database.php to change the database login credentials
This is our final database schema:
We came up with it by first listing all the necessary information, then normalizing it. Some changes such as variable size and switching foreign keys were done later as needed. Some improvements that could be made are allowing customers to have many phone numbers and emails but that wasn’t necessary for this database. Sale_price is how we track how much the item cost when it was purchased. If the website or whatever the database could be used for would like to show the cost reduction of the sale price there would need to be another variable.
http://localhost/gorkhali_store/api/orders/read.php?status=completed&date_start=1990-01-01&date_end=2010-01-01
Where the parameters are status, date_start, and date_end. This retrieves all customers orders with dates between 1990 and 2010.
Example of creating a customer:
http://localhost/gorkhali_store/api/customer/read.php?first_name=Jone&last_name=Cena&email=john@john.com&phone_number=1236987
Based off the schema, needs first_name, last_name, email, and a phone_number.
Shows POST was successful.
Example of updating existing data.
http://localhost/gorkhali_store/api/customer/read.php?first_name=Dywan&last_name=Johnson&email=rock@rock.com&phone_number=1236987&c_id=26
Same as POST
Example of deleting existing data.
http://localhost/gorkhali_store/api/customer/read.php?c_id=26
Pass it the c_id.
Now that line is NULL.