Cloud Computing Assignment - Creating a simple REST API
"Alexandru Ioan Cuza" University of Iași, Romania
Faculty of Computer Science
Ștefan Bogdan
stefanbogdan.sbg@gmail.com
Create an application that provides a RESTFull API. It is mandatory to use at
least: GET, POST, PUT, DELETE. It is very important to respect all additional
requirements specified in the laboratory.
Important note: You are not allowed to use any web frameworks!
-
I have made this api purely for educational purposes.
-
The api gives access to a database of cars. For the sake of simplicity, this "database" is nothing more than a few "Car" objects stored in a python dictionary.
-
The initialisation process populates the database with the following cars:
ID Make Model Year Price € 1 Ford Focus 2012 8000 2 Dacia Logan 2006 2400 3 BMW 320d 2010 10100
- I would make it easier to introduce/remove supported calls (maybe using python decorators and regex).
- I would change the GET path for a single car from
/car/id
to/cars/id
. - Regarding unit-testing, I would use a single test suite instead of multiple small tests.
- I would make a
CarList
class to store all the cars and CRUD functions.
- GET
/cars
- GET
/car/id
- POST
/cars
- PUT
/car/id
- DELETE
/car/id
Note: A JSON containing all the necessary attributes should be present in a POST or PUT request's body.
Beginner's Guide to Creating a REST API
HTTP Status Codes
Richardson Maturity Model
How to Create a REST Protocol
The Difference Between POST and PUT
PUT or POST: The REST of the Story
REST APIs must be hypertext-driven