- Git
- Python >=3.6
- Flask
- Yarn (optional)
- NPM (optional)
- Go to https://www.python.org/downloads/ and download the latest version of Python with pip for your OS.
- Go to https://git-scm.org and install the latest version of git
-
Create a fork of this repo https://github.com/open-source-at-illinois/rest-api-workshop-fa21.
git clone "https://github.com/your_username_/Project_Name.git" restapi cd restapi/api
pip install -r requirements.txt set FLASK_ENV=development flask run
Slides are available here
- Use this website https://rest-api-workshop-fa21.vercel.app/ to check the functionality of your API
- Write the 5 HTTP methods in
api/app.py
- get(“/”) - returns a key-value pair, with key "message" and value "Welcome to OSAI" *TIP: Refer to slide 14
- get(“/all”) - returns events currently stored in the API
- post(“/event”) - Adds an event to the end of the events dictionary stored in the API
*
request.json
contains the data you add in the form * puts the data into a new key-value pair in events * returns the index in string format - put(“/event/<event_id>”)
* takes in 1 argument called event_id of int type
* adds the data in
request.json
to events and returns it - delete(“/event/<event_id>”) * takes in 1 argument called event_id of int type * deletes the key-value pair with the id passed in * returns a "Deletion Successful" message