Skip to content

API consumption

Kurosh Husseini edited this page Apr 29, 2024 · 15 revisions

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 must include an auxiliary service that interacts with your API (and possibly the client).

CHAPTER GOALS

  • 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 30 points) You can get a maximum of 30 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.

✏️ Write here your application description


SelliX is an online marketplace designed to tackle the issue of textile waste management while providing a convenient platform for people to buy or sell their used items and devices. With an easy-to-use interface and a wide range of categories, SelliX provides a solution for those looking to declutter their homes or find specific items at affordable prices. By facilitating the reuse of items that would otherwise end up in landfills, SelliX aims to minimize environmental impact and promote sustainability.

Goals and Benefits for Users:

  • Environmental Impact: By encouraging people to sell, buy, or rent used items, SelliX aims to reduce the amount of waste that ends up in landfills.
  • Convenience: SelliX provides a convenient platform for users to declutter their homes or find desired items without needing to visit physical stores.
  • Financial Gain: Users can earn money from items they no longer need, promoting a circular economy model.
  • User Satisfaction: SelliX enhances the user experience by providing features such as product reviews, seller ratings, and detailed product descriptions.

Functionality Provided by RESTful API:

  • Authentication and create account
  • View profile and edit your information
  • View, Create, Delete and Edit a product
  • View created products by other users
  • Purchase a product and view purchased products
  • Favour a product and view favourites
  • Search and Filtering

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


use_case_diagram.png

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 http://webdesignledger.com/tools/13-super-useful-ui-wireframe-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.

products_wireframe product_wireframe create_product_wireframe


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?)

kuva

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

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.).

For auxiliary service, we implemented another API that processes data analysis and provides data endpoints for our client. It processes for example, how many products have been listed in last 24 hours. It is standalone service that does not effect on client or main API usage.


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.

Auxiliary service is not necessary part of ecosystem, but it can provide information for client if client needs it.

image


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


Resources allocation

Task Student Estimated time
I have installed and initialized the project and created most components, such as the products list, product details page, and login forms. I selected and configured the appropriate dependencies within the project, ensuring a sound design pattern and code structure. I have also implemented functionality for handling the fetching, creating, deleting, and purchasing of products, as well as dynamic routes and authentication features, logout, and navigation, including middleware for authenticating and storing cookies. Additionally, I have configured Firebase and implemented functionality for saving images. I fixed the backend to be more compatible with the front end and configured ESlint for code quality. Kurosh Husseini 65h
Client, API, Auxiliary Konsta Laurila 20h
Client, API, Tests Bishwas Wagle 20h
Client, API Aleksi Illikainen 35h

Clone this wiki locally