CIS 3368 Exam 1, SPRING 2022 – DEADLINE 03/12/2022 11:59pm Development of REST API services with Python, mySQL and Flask The main objective of this assignment is to create several API endpoints that...

Python programming homework


CIS 3368 Exam 1, SPRING 2022 – DEADLINE 03/12/2022 11:59pm Development of REST API services with Python, mySQL and Flask The main objective of this assignment is to create several API endpoints that can be used in other applications to perform CRUD operations on a dataset revolving about energy production. 1. Set up a table in your database named 'powerplant' according to the following schema: id name type capacity inauguration active Pick appropriate types for each column. The id of every record should be created automatically. The name represents the name of the power plant. The type should represent the power plants type. For instance, there are 'nuclear', 'hydroelectric', 'geo-thermal', 'solar', 'wind', etc. The capacity should list the capacity of the individual power plants, a decimal number in Megawatt (MW). The inauguration field should have the date that indicates when the power plant's construction was completed and it started to produce power. The active field should indicate if the power plant is active. Fill your table with at least 5 records. You might have to do some research if you are not familiar with the subject. For instance, one entry could look like this: id name type capacity inauguration active 1 Three Gorges Dam hydroelectric 22500 12/14/12 TRUE 2. Create the following 4 REST API service endpoints to perform CRUD operations: 1. /api/powerplant method GET: This endpoint should allow to get a list of all power plants, sorted by their maximum capacity descending. 2. /api/powerplant method POST: This endpoint should allow the caller to add a new power plant, if the caller also provides a valid time token. 3. /api/powerplant method DELETE: This endpoint should allow the caller to set a power plant to inactive (NOT delete it from the table), if they are authorized to so so via a token. The universally accepted master token for this operation is: 880088 4. /api/powerplant method PUT: This endpoint should allow the caller to update the capacity of an existing power plant (no other fields). This exam requires you to have a remote MySQL database setup in AWS or another cloud of your choice. (local DB setups will not be accepted and result in zero credit for this portion of the exam). It is recommended that you use MySQL Workbench for creating the table and adding the 5 initial records. But you can use any tool that you are comfortable with. You do not have to submit any SQL code that fills the table. Other Requirements • Make sure the username and password for the database you setup are credentials you’re willing to share. Do not use personal passwords for this exam, which you might be using anywhere else. • Make sure your project compiles and runs. If the code doesn’t run, you will forfeit points. This includes submitting all files required by your project! Extra credit Use UUID as data type for the autogenerated ID column of your table. What to Turn in Submit your source code (all Python files) as single zip file via Blackboard. Your code has to have meaningful comments explaining how you worked through the problem. You will only get full points if can explain why you choose certain solutions, where you found them (if you use resources outside of the class material) and how you implemented them. You can use the sql.py file we have created in class, but don't forget to submit it as part of your source code. Grading rubric for this exam Item Points Endpoint 1 20 Endpoint 2 20 Endpoint 3 20 Endpoint 4 20 Code comments 5 Database and table setup with records 15 Extra Credit 5 Total 100 Deduction 50% if code doesn’t compile (up to -50) Last updated 2022-03-10 CIS 3368 Exam 1, SPRING 2022 – DEADLINE 03/12/2022 11:59pm Development of REST API services with Python, mySQL and Flask Other Requirements Extra credit What to Turn in Grading rubric for this exam
Mar 12, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here