- REST-style endpoints using HTTP verbs (GET, POST, PUT, DELETE)
- JSON- and form-based request handling
- Persistent storage using a local JSON file
- Basic input validation and error handling
- Simple resource-oriented API design
- rest_api.py – Flask REST API implementation
- videos.json – Persistent storage for video metadata
- /videos/all – Retrieve all videos
- /videos/<video_id> – Retrieve a single video
- /videos – Create a new video entry
- /videos/<video_id> – Create or update a video
- /videos/<video_id> – Delete a video
- title (string, required)
- uploadDate (integer, optional)
This project demonstrates:
- Basic REST API design
- HTTP request handling in Flask
- Stateless services with simple persistence
- Foundational backend concepts relevant to larger web systems
Note: This is an educational example and not intended for production use.
Terminal output: bruker@MacBook-Pro-2 ~ % curl -4 http://localhost:5000/videos {"video1": {"title": "Hello World in python", "uploadDate": 20210917}, "video2": {"title": "Why language something", "uploadDate": 20210918}} bruker@MacBook-Pro-2 ~ % curl -4 http://localhost:5000/videos -d "title=Newest Awesome Video" -d "uploadDate=20220101" -X POST {"video3": {"title": "Newest Awesome Video", "uploadDate": 20220101}} bruker@MacBook-Pro-2 ~ % curl -4 http://localhost:5000/videos -d "title=Newest Awesome Videpååpppppåååååååo" -d "uploadDate=20190101" -X POST {"video4": {"title": "Newest Awesome Videp\u00e5\u00e5ppppp\u00e5\u00e5\u00e5\u00e5\u00e5\u00e5\u00e5o", "uploadDate": 20190101}} bruker@MacBook-Pro-2 ~ % curl -4 http://localhost:5000/videos {"video4": {"title": "Newest Awesome Videp\u00e5\u00e5ppppp\u00e5\u00e5\u00e5\u00e5\u00e5\u00e5\u00e5o", "uploadDate": 20190101}, "video1": {"title": "Hello World in python", "uploadDate": 20210917}, "video2": {"title": "Why language something", "uploadDate": 20210918}, "video3": {"title": "Newest Awesome Video", "uploadDate": 20220101}} bruker@MacBook-Pro-2 ~ %
