Web Technologies/2021-2022/Laboratory 10

Representational state transfer (REST) is a software architectural style that describes a uniform interface between physically separate components, often across the Internet in a client-server architecture.

Readings

 * Representational state transfer
 * Miguel Grinberg: Designing a RESTful API with Python and Flask

Exercise
Create a REST API that has the role of an artifact repository. An artifact 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 artifacts:
 * Each artifact could be stored in a directory which indicates its purpose (you can think of it as grouping artifact of a project)
 * It should have a resources that allows the listing of all directories and the artifact currently contained in a directory
 * Resource for fetching, adding and deleting artifact

Examples using Flask can be found here and here.

Example
Here is an example structure of the REST API:


 * returns list of available directories


 * returns list of all artifacts from directory


 * push artifact in repository


 * get artifact by id from directory


 * delete entire directory and artifacts


 * delete artifact


 * replace artifact (deleting the old one)

After you have finished consider how you can add support for more advanced features such as versioning of artifacts.