API deployment and consumption - jpehkone21/PWP GitHub Wiki

Important information for Deadline 5

โ€ผ๏ธ  This chapter should be completed by Deadline 5 (see course information at Lovelace)


๐Ÿ“‘  Chapter summary In this section your group must design, implement and test a client application that uses the RESTful API implemented by you. If you utilize HTML and JavaScript, it is mandatory that the HTML is contained in static files. It means that your server cannot generate HTML dynamically (using PHP or JSP). All modifications made to the webpage must be done in the client side using javascript. Of course, you can use anchors () to load a new URL. Please, consider the Same Origin Policy" because it might cause problems to your client implementation. It is recommend to host the files in a local HTTP server and not directly in your file system. We will give you more instructions in Exercise 4.

In addition, you can either

  • Include an auxiliary service that interacts with your API (and possibly the client). More information in Exercise 4.
  • Deploy your web api in a production environment, as explained in Exercise 3

CHAPTER GOALS

  • Deploy an API in a production environment
  • Learn how to use APIs
  • Implement a client that uses the project API
  • Implement an auxiliary service that interacts with your API

โœ”๏ธ     Chapter evaluation (max 26 points) You can get a maximum of 26 points after completing this section. You can check more detailed assessment criteria in the Lovelace return box for Deadline 5.

RESTful Client

Client application description

Overview

๐Ÿ“‘  Content that must be included in the section You must provide a description of the application. You must clarify which are the goals of the application and why a user would like to use this application. You must also state what is the functionality provided by the RESTful API used by this application.

The application is quotes giving API that works on commanline client. There are animals, creatures and humans that can give a quote for the user. The user can get, post, edit and delete a quote and the character that is giving the quote. The characters and quotes are stored in database.

The goal is to create API that is easy to use and would add positivity to people's days. We thought people would like to get creative and funny quotes to make their day better. They can create their favourite characters and be as creative they can.


Functional requirements

๐Ÿ“‘  Content that must be included in the section Provide a use case diagram of your application. For each case, specify which is the API resource/s that cover the given functionality

โœ๏ธ Draw your diagram here including a discussion of use cases


Client design

GUI layout

๐Ÿ“‘  Content that must be included in the section Draw a diagram of the client layout. Students can use any software they want to do the sketching. For more professional-like design, students can use any wireframing tool available in Internet. Some of them can be found from https://www.hostinger.com/tutorials/best-wireframing-tools. Pencil is free, open source and easy to use. Other options are Visio and Balsamiq (you need a license). You can also create the UI using a paper and a pencil and scan the resulting drawing.

image


Screen workflow

๐Ÿ“‘  Content that must be included in the section Draw the screen workflow of your client (which are the possible screens that you can access from one specific screen?)

โœ๏ธ Add your diagrams here

Client implementation

๐Ÿ’ป     TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. The source code for the client application. 
  2. External libraries. You can also report them in the README.md if the libraries are very big or need to be installed.
  3. The code for testing the application (if it exists).
  4. We recommend to include a set of scripts to run your application and tests (if they exist).
  5. A README.md file containing:
    • Dependencies (external libraries)
    • How to setup/install the client
    • How to configure and run the client
    • How to run the different tests of your client (if you have implemented unit testing)
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 4 for examples on how to document the code. addition, should be clear which is the code you have implemented yourself and which is the code that you have borrowed from other sources.

โœ๏ธ Implement your client and include a few screenshots of the final version of the client to show that meets the requirements


Auxiliary Service

Please, note that if you are deploying your WEB API as instructed in Exercise 3, you do not need to complete this task.

Service description

Overview

๐Ÿ“‘  Content that must be included in the section You must provide a description of the service. You must clarify which are the goals of the service and how it interacts with your API (and possibly the client). The service can be autonomous entity that does some automated work on the API (data cleaning, calculating composites etc.), or it can be commanded from the client interface to perform heavier tasks that would clog the API server itself (statistics generation, recommendation algorithms etc.).

โœ๏ธ Write your description here


Functional requirements

๐Ÿ“‘  Content that must be included in the section Provide a diagram that shows how the service communicates with other parts in the ecosystem.

โœ๏ธ Put your diagram here


Auxiliary service implementation

๐Ÿ’ป     TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. The source code for the auxiliary service. 
  2. External libraries. You can also report them in the README.md if the libraries are very big or need to be installed.
  3. The code for testing the service (if it exists).
  4. We recommend to include a set of scripts to run your service and tests (if they exist).
  5. A README.md file containing:
    • Dependencies (external libraries)
    • How to setup/install the service
    • How to configure and run the service
    • How to run the different tests of your service (if you have implemented unit testing)
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 4 for examples on how to document the code. Should be clear which is the code you have implemented yourself and which is the code that you have borrowed from other sources.

โœ๏ธ Do not need to write anything here. Implement your service


Web API production deployment

NOTE: This section might have significant changes along the course, please stay tunned to possible modifications. They will be discussed in Discord / Lovelace

Please, note that if you are creating an auxiliary service, you do not need to complete this task.

Deployment architecture

Overview

๐Ÿ“‘  Content that must be included in the section You must provide an architecture diagram of the system ready for production deployment, including all the different components as well as their connections.

โœ๏ธ Add your diagram here


Tools description

๐Ÿ“‘  Content that must be included in the section List all components you are using and a description of the role and functionality that this component has in the system. Explain why this component is necessary for and list alternatives.

โœ๏ธ Add your text here


Deployment

๐Ÿ’ป Content that must be included in this section You must deploy the Wep API in environment similar to the one proposed in Exercise 3 and show that is working      TODO: SOFTWARE TO DELIVER IN THIS SECTION The code repository must contain:
  1. Scripts needed to setup the environment and deploy the web apit 
  2. Software needed to create and maintain the certificates
  3. A README.md file containing:
    • List of components that must be installed
    • How to setup the environment
    • How to deploy the web api into the environment
    • How to run the different tests to check that your environment is properly configure
Should be clear which is the code you have implemented yourself and which is the code that you have borrowed from other sources.

๐Ÿ“ Do not need to write anything here. Deploy your API and include all necessary files in the repository


Use of AI


We used ChatGPT to write some of the repetitive code for the client. For example, we would write the function to post a human, and tell ChatGPT to do the same for creature and animal.


Resources allocation

Task Student Estimated time
writing, starting client develoment Iina Nikkarikoski 2h
making client Johanna Pehkonen 2,5h
writing, planning client Iiris Kivelรค 2h
โš ๏ธ **GitHub.com Fallback** โš ๏ธ