Web Technologies/2021-2022/Assignment 3
Non-negociable submission rules:
- Submission should a single file in .zip format (NOT .rar or .7z).
- Name the file you submit <firstname>_<lastname>.zip.
- Code must be original (i.e. not identical to other submissions).
- Code must NOT be generated using gen-AI tools such as ChatGPT.
- Any submissions after the deadline are automatically disregarded.
Exercises
editCreate a REST API that has the role of an artefact repository. An artefact is defined as any file which can be stored onto a disk (i.e. image, document, source code etc.). The REST API should be able to:
- Have a directory structure which contains the artefacts:
- Each artifact could be stored in a directory which indicates its purpose (you can think of it as grouping artefacts of a project)
- It should have a resources that allows the listing of all directories and the artefacts currently contained in a directory
- Resource for fetching, adding and deleting artefacts
Examples for file uploads using Flask can be found here and here.
Example
editHere is an example structure of the REST API:
GET /artefacts/
- returns list of available directories
GET /artefacts/<directory>
- returns list of all artefacts from directory
POST /artefacts/<directory>/<artefact_id>
- push artefact in repository
GET /artefact/<directory>/<artefact_id>
- get artefact by id from directory
DELETE /artefact/<directory>
- delete entire directory and artefacts
DELTE /artefact/<directory>/<artefact_id>
- delete artefact
PUT /artefact/<directory>/<artefact_id>
- replace artefact (deleting the old one)
After you have finished consider how you can add support for more advanced features such as versioning of artifacts.
Resources: