Jump to content

Web technologies/2014-2015/Laboratory 13

From Wikiversity

Web Service using REST API

[edit | edit source]

Create a simple RESTful web services that accepts artifacts and stores them based on their id. The web service should have the following structure:

Methods Resource Description
GET /store/api/v1.0/artifacts returns a list of artifacts as well as their associated id
GET /store/api/v1.0/artifacts/{id} returns information about the file (date, location on disk)
POST /store/api/v1.0/artifact/{id} accepts as payload the artifact itself (uploads it to the service)
DELETE /store/api/v1.0/artifact/{id} delete artifact with the current id
GET /store/api/v1.0/artifacts/{id}/fetch returns the file itself

Features:

[edit | edit source]
  • You can use whatever technology you deem necessary (Flask, NodeJS, Jersey, Java Servlets etc.)
  • All responses should be in JSON format (except when the item is returned)
  • HTTP Status codes should be appropriate to the given context
  • Artefacts should be stored on the computer file systems and renamed to the id used in the resource
    • If the directory is does not exist the service should create it
    • BONUS: How would you modify the resource structure so that artifacts could be grouped or versioned?
  • BONUS: Because you could never trust user input think on how you can verify if the file name is in a certain format (using predefined web platform methods is allowed).

Links:

[edit | edit source]
  • Flask documentation [1]
  • Jersey [2]
  • NodeJS [3]

Gabriel Iuhasz, 2016-12-12, iuhasz.gabriel@e-uvt.ro