RESTful API implementation - VilleKylmamaa/WorkoutLogAPI GitHub Wiki

Important information for Deadline 4

‼️  This chapter should be completed by Deadline 4 (see course information at Lovelace)


📑  Chapter summary In this section you must implement the RESTful API designed in the previous section. The minimum requirements are summarized in the Minimum Requirements section of the Project Work Assignment. If you do not meet the minimum requirements this section WILL NOT be evaluated.

CHAPTER GOALS

  • Implement a RESTful API
  • Write tests for the API


✔️     Chapter evaluation (max 18 points) You can get a maximum of 18 points after completing this section. More detailed evaluation is provided after each heading.

RESTful API implementation

List of implemented resources


📑  Content that must be included in the section A list of all implemented resources. Consider that not all resources that you have designed must be implemented.  The minimum requirements are summarized in the Minimum requirements section from the Project work assignment. You can use a table similar to the one you used to explain the uniform interface. Do not forget to include in the README.md file which is the path to access to your application remotely.


✔️     Evaluation criteria(max 0.5 points) In this section you can get a maximum of 0.5 points.
  • The table clearly shows which resources are implemented, and what requests they support: 0.5

✏️ Write here your text

Implemented Resources

The following resources and methods are implemented:

GET PUT PATCH POST DELETE
WorkoutCollection gets all the workout sessions creates a new workout session
WorkoutsByExercise gets all the workout sessions in which a specific exercise has been done
WorkoutItem gets in a specific workout session, including the exercises done within it and the sets done for the exercises edits the data values in a specific workout session deletes a specific workout session
ExerciseCollection gets all the exercises, including all their max data and the sets done for the exercises creates a new exercise
ExercisesWithinWorkout gets all the exercises which were done in a specific workout creates a new exercise and adds it to the workout, or adds an existing one if it already exists
ExerciseItem gets a specific exercise, including all its max data and the sets done for it edits the specific exercise removes the exercise from the workout if the link has a workout i.e. it's a link for an exercise within a workout, otherwise deletes the specific exercise and all its max data and sets
SetsWithinWorkout gets all sets done in a specific workout for a specific exercise Adds a new set to the specific workout for the specific exercise
SetItem gets a specific set done in a specific workout for a specific exercise edits the specific set deletes the specific set
MaxDataForExerciseCollection gets all the max data for a specific exercise adds new max data entry
MaxDataItem gets a specific max data entry for a specific exercise edits the specific max data entry deletes the specific max data
WeeklyProgrammingCollection gets all the weekly programming data creates a new weekly programming data entry
WeeklyProgrammingForExercise gets all weekly programming data entries for a specific exercise
WeeklyProgrammingItem gets a specific weekly programming data entry for a specific exercise type and week number edits the specific weekly programming data entry deletes the specific weekly programming data entry

Resources implementation

💻     TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. The source code for the RESTful API 
  2. The external libraries that you have used
  3. We recommend to include a set of scripts to setup and run your server
  4. A database file or the necessary files and scripts to automatically populate your database.
  5. A README.md file containing:
    • Dependencies (external libraries)
    • How to setup the framework.
    • How to populate and setup the database.
    • How to setup (e.g. modifying any configuration files) and run your RESTful API.
    • The URL to access your API (usually nameofapplication/api/version/)=> the path to your application.
NOTE: Your code MUST be clearly documented. For each public method/function you must provide: a short description of the method, input parameters, output parameters, exceptions (when the application can fail and how to handle such fail). Check Exercise 3 for examples on how to document the code.  In addition should be clear which is the code you have implemented yourself and which is the code that you have borrowed from other sources


✔️     Evaluation criteria(max 5.5 points) In this section you can get a maximum of 5.5 points:
  • Instructions to set up the API and run the tests are provided in the README.md file: 1.0
    • this means there should be no undocumented extra steps in running the code/tests!
  • The code has clear structure and naming for variables and methods: 1.0
  • You have clearly marked which parts of the code are your own work and which have been borrowed: 0.5
  • Each method's functionality is described in its documentation: 1.0
  • Documentation for auxiliar functions(if any) have correct input / output description: 0.5
  • Implementation matches the design of the previous section: 1.5 (0.75 if there are minor mismatch (e.g. missing parameters, wrong header...), 0 if several calls differ)

✏️ You do not need to write anything in this section, just complete the implementation.

RESTful API testing

💻     TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. The code to test your RESTful API (Functional test)
    • The code of the test MUST be commented indicating what you are going to test in each test case.
    • The test must include values that force error messages
  2. The external libraries that you have used
  3. We recommend to include a set of scripts to execute your tests.
  4. A database file or the necessary files and scripts to automatically populate your database.
  5. A README.md file containing:
    • Dependencies (external libraries)
    • Instructions on how to run the different tests for your application.
Do not forget to include in the README.md the instructions on how to run your tests. Discuss briefly which were the main errors that you detected thanks to the functional testing.

Remember that you MUST implement a functional testing suite. A detailed description of the input / output in the a REST client plugin.

As with the database tests, in this section it is your responsibility that your API handles requests correctly. All of the example requests in your API documentation should work, and your API must give the responses from your documentation. You also need to show that invalid requests are properly handled, and that the responses match those in the documentation.



✔️     Evaluation criteria(max 12 points) In this section you can get a maximum of 12 points:
  • Test cases run correctly: 1.0
  • Test coverage >=96%: 3.0 (2.0 if coverage between 91% and 95%, 1.0 if coverage between 85% and 90%,0 otherwise)
  • Test cases cover all predictable error scenarios (various invalid requests) for all methods:3.0
  • Test output clearly describes the testing process for each case: 1.0
  • The interface works as intended (i.e. we don't find any errors. ) Errors will diminish this grade: 4.0
  • NOTE: In group with 4 people we will be more strict when assigning grades in this section.

✏️ You do not need to write anything in this section, just complete the implementation.

Main errors I detected thanks to testing were schema errors such as wrong types or typos in the schema, and problems with POST and PUT methods.

Resources allocation

Task Student Estimated time
All Ville Kylmämaa 35h
⚠️ **GitHub.com Fallback** ⚠️